In This Article

InfoBar Class

Displays a bar with information of varying severity.

[TemplatePart(Name = "PART_ActionPresenter", Type = typeof(InputElement))]
[TemplatePart(Name = "PART_CloseButton", Type = typeof(Button))]
[TemplatePart(Name = "PART_ContentPresenter", Type = typeof(ContentPresenter))]
[TemplatePart(Name = "PART_IconPresenter", Type = typeof(ContentPresenter))]
[TemplatePart(Name = "PART_MessageElement", Type = typeof(InputElement))]
[TemplatePart(Name = "PART_TitleElement", Type = typeof(InputElement))]
[PseudoClasses(new string[] { ":wrapped" })]
[PseudoClasses(new string[] { ":information", ":success", ":warning", ":error" })]
public class InfoBar : ContentControl, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, IStyleable, INamed, IInputElement, IDataTemplateHost, ISetterValue
Inheritance:
object AvaloniaObject Animatable StyledElement Visual Layoutable Interactive InputElement Control TemplatedControl ContentControl object
Implements:
IDataContextProvider ILogical IThemeVariantHost IResourceHost IResourceNode IStyleHost ISetLogicalParent ISetInheritanceParent IStyleable INamed IInputElement IDataTemplateHost ISetterValue

Constructors

InfoBar()

Initializes a new instance of the class.

public InfoBar()

Properties

Action

The action (e.g., a button or hyperlink).

[DependsOn("ActionTemplate")]
public object? Action { get; set; }

Property Value

object

ActionTemplate

The template used to display the Action.

public IDataTemplate? ActionTemplate { get; set; }

Property Value

IDataTemplate

CanClose

Indicates if the control can be closed.

public bool CanClose { get; set; }

Property Value

bool:

The default value is true.

CloseButtonCommand

The command associated with the close button.

public ICommand? CloseButtonCommand { get; set; }

Property Value

ICommand

See Also

CloseButtonCommandParameter

The parameter to be passed to the CloseButtonCommand.

public object? CloseButtonCommandParameter { get; set; }

Property Value

object

See Also

CloseButtonTheme

The control theme to be used for the close button.

public ControlTheme CloseButtonTheme { get; set; }

Property Value

ControlTheme

HasAction

Indicates whether Action has a non-null value.

public bool HasAction { get; }

Property Value

bool

HasContent

Indicates whether Content has a non-null value.

public bool HasContent { get; }

Property Value

bool

HasMessage

Indicates whether Message has a non-null, non-empty value.

public bool HasMessage { get; }

Property Value

bool

HasTitle

Indicates whether Title has a non-null, non-empty value.

public bool HasTitle { get; }

Property Value

bool

HorizontalSpacing

The amount of horizontal spacing that appears between controls other than the icon and close button.

public double HorizontalSpacing { get; set; }

Property Value

double:

The default value is 10.

Icon

The content for the icon.

[DependsOn("IconTemplate")]
public object? Icon { get; set; }

Property Value

object

IconTemplate

The template used to display the Icon.

public IDataTemplate? IconTemplate { get; set; }

Property Value

IDataTemplate

IsAnimationEnabled

Whether animation is enabled.

public bool IsAnimationEnabled { get; set; }

Property Value

bool:

The default value is true.

IsIconVisible

Indicates if the icon is visible.

public bool? IsIconVisible { get; set; }

Property Value

bool?:

true to force the icon to be visible, false to force the icon to be hidden, or null to show the icon only when icon content is available. The default value is null.

IsOpen

Indicates if the control is open.

public bool IsOpen { get; set; }

Property Value

bool:

The default value is true.

Remarks

Use this property instead of the IsVisible property to control if the info bar is displayed.

IsWrapped

Indicates whether the layout is wrapped to multiple lines.

public bool IsWrapped { get; set; }

Property Value

bool:

true if the layout is wrapped to multiple lines; otherwise, false if the layout (excluding content) is on a single line.

Message

The message.

public string? Message { get; set; }

Property Value

string

Severity

The severity of the message.

public InfoBarSeverity Severity { get; set; }

Property Value

InfoBarSeverity:

The default value is Information.

Title

The title.

public string? Title { get; set; }

Property Value

string

VerticalSpacing

The amount of vertical spacing that appears between controls.

public double VerticalSpacing { get; set; }

Property Value

double:

The default value is 10.

Methods

OnApplyTemplate(TemplateAppliedEventArgs)

Called when the control's template is applied. In simple terms, this means the method is called just before the control is displayed.

protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
Parameter Type Description
e TemplateAppliedEventArgs

The event args.

OnCreateAutomationPeer()

Returns a new, type-specific Avalonia.Automation.Peers.AutomationPeer implementation for the control.

protected override AutomationPeer OnCreateAutomationPeer()

Returns

AutomationPeer:

The type-specific Avalonia.Automation.Peers.AutomationPeer implementation.

RegisterContentPresenter(ContentPresenter)

Called when an Avalonia.Controls.Presenters.ContentPresenter is registered with the control.

protected override bool RegisterContentPresenter(ContentPresenter presenter)
Parameter Type Description
presenter ContentPresenter

The presenter.

Returns

bool

ToString()

Returns the string representation of this object.

public override string ToString()

Returns

string:

The string representation of this object.

Events

CloseButtonClick

Occurs when the close button is clicked.

public event EventHandler<RoutedEventArgs>? CloseButtonClick

Event Type

EventHandler<RoutedEventArgs>

Remarks

Set RoutedEventArgs.Handled to true to prevent default handling of the click event.

Closed

Occurs when the info bar is closed.

public event EventHandler<EventArgs>? Closed

Event Type

EventHandler<EventArgs>

Closing

Occurs when the info bar is in the process of being closed.

public event EventHandler<InfoBarClosingEventArgs>? Closing

Event Type

EventHandler<InfoBarClosingEventArgs>

Fields

ActionProperty

Defines the Action property.

public static readonly StyledProperty<object?> ActionProperty

ActionTemplateProperty

Defines the ActionTemplate property.

public static readonly StyledProperty<IDataTemplate?> ActionTemplateProperty

CanCloseProperty

Defines the CanClose property.

public static readonly StyledProperty<bool> CanCloseProperty

CloseButtonCommandParameterProperty

Defines the CloseButtonCommandParameter property.

public static readonly StyledProperty<object?> CloseButtonCommandParameterProperty

CloseButtonCommandProperty

Defines the CloseButtonCommand property.

public static readonly StyledProperty<ICommand?> CloseButtonCommandProperty

CloseButtonThemeProperty

Defines the CloseButtonTheme property.

public static readonly StyledProperty<ControlTheme> CloseButtonThemeProperty

HasActionProperty

Defines the HasAction property.

public static readonly DirectProperty<InfoBar, bool> HasActionProperty

HasContentProperty

Defines the HasContent property.

public static readonly DirectProperty<InfoBar, bool> HasContentProperty

HasMessageProperty

Defines the HasMessage property.

public static readonly DirectProperty<InfoBar, bool> HasMessageProperty

HasTitleProperty

Defines the HasTitle property.

public static readonly DirectProperty<InfoBar, bool> HasTitleProperty

HorizontalSpacingProperty

Defines the HorizontalSpacing property.

public static readonly StyledProperty<double> HorizontalSpacingProperty

IconProperty

Defines the Icon property.

public static readonly StyledProperty<object?> IconProperty

IconTemplateProperty

Defines the IconTemplate property.

public static readonly StyledProperty<IDataTemplate?> IconTemplateProperty

IsAnimationEnabledProperty

Defines the IsAnimationEnabled property.

public static readonly StyledProperty<bool> IsAnimationEnabledProperty

IsIconVisibleProperty

Defines the IsIconVisible property.

public static readonly StyledProperty<bool?> IsIconVisibleProperty

IsOpenProperty

Defines the IsOpen property.

public static readonly StyledProperty<bool> IsOpenProperty

IsWrappedProperty

Defines the IsWrapped property.

public static readonly DirectProperty<InfoBar, bool> IsWrappedProperty

MessageProperty

Defines the Message property.

public static readonly StyledProperty<string?> MessageProperty

SeverityProperty

Defines the Severity property.

public static readonly StyledProperty<InfoBarSeverity> SeverityProperty

TitleProperty

Defines the Title property.

public static readonly StyledProperty<string?> TitleProperty

VerticalSpacingProperty

Defines the VerticalSpacing property.

public static readonly StyledProperty<double> VerticalSpacingProperty

Inherited Members

  • ContentControl.ContentProperty
  • ContentControl.ContentTemplateProperty
  • ContentControl.HorizontalContentAlignmentProperty
  • ContentControl.VerticalContentAlignmentProperty
  • ContentControl.OnPropertyChanged(AvaloniaPropertyChangedEventArgs)
  • ContentControl.Content
  • ContentControl.ContentTemplate
  • ContentControl.Presenter
  • ContentControl.HorizontalContentAlignment
  • ContentControl.VerticalContentAlignment
  • TemplatedControl.BackgroundProperty
  • TemplatedControl.BackgroundSizingProperty
  • TemplatedControl.BorderBrushProperty
  • TemplatedControl.BorderThicknessProperty
  • TemplatedControl.CornerRadiusProperty
  • TemplatedControl.FontFamilyProperty
  • TemplatedControl.FontFeaturesProperty
  • TemplatedControl.FontSizeProperty
  • TemplatedControl.FontStyleProperty
  • TemplatedControl.FontWeightProperty
  • TemplatedControl.FontStretchProperty
  • TemplatedControl.ForegroundProperty
  • TemplatedControl.PaddingProperty
  • TemplatedControl.TemplateProperty
  • TemplatedControl.IsTemplateFocusTargetProperty
  • TemplatedControl.TemplateAppliedEvent
  • TemplatedControl.GetIsTemplateFocusTarget(Control)
  • TemplatedControl.SetIsTemplateFocusTarget(Control, bool)
  • TemplatedControl.ApplyTemplate()
  • TemplatedControl.GetTemplateFocusTarget()
  • TemplatedControl.OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs)
  • TemplatedControl.OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs)
  • TemplatedControl.OnTemplateChanged(AvaloniaPropertyChangedEventArgs)
  • TemplatedControl.Background
  • TemplatedControl.BackgroundSizing
  • TemplatedControl.BorderBrush
  • TemplatedControl.BorderThickness
  • TemplatedControl.CornerRadius
  • TemplatedControl.FontFamily
  • TemplatedControl.FontFeatures
  • TemplatedControl.FontSize
  • TemplatedControl.FontStyle
  • TemplatedControl.FontWeight
  • TemplatedControl.FontStretch
  • TemplatedControl.Foreground
  • TemplatedControl.Padding
  • TemplatedControl.Template
  • TemplatedControl.TemplateApplied
  • Control.FocusAdornerProperty
  • Control.TagProperty
  • Control.ContextMenuProperty
  • Control.ContextFlyoutProperty
  • Control.RequestBringIntoViewEvent
  • Control.ContextRequestedEvent
  • Control.LoadedEvent
  • Control.UnloadedEvent
  • Control.SizeChangedEvent
  • Control.OnLoaded(RoutedEventArgs)
  • Control.OnUnloaded(RoutedEventArgs)
  • Control.OnSizeChanged(SizeChangedEventArgs)
  • Control.OnAttachedToVisualTreeCore(VisualTreeAttachmentEventArgs)
  • Control.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs)
  • Control.OnGotFocus(GotFocusEventArgs)
  • Control.OnLostFocus(RoutedEventArgs)
  • Control.OnPointerReleased(PointerReleasedEventArgs)
  • Control.OnKeyUp(KeyEventArgs)
  • Control.FocusAdorner
  • Control.DataTemplates
  • Control.ContextMenu
  • Control.ContextFlyout
  • Control.IsLoaded
  • Control.Tag
  • Control.ContextRequested
  • Control.Loaded
  • Control.Unloaded
  • Control.SizeChanged
  • InputElement.FocusableProperty
  • InputElement.IsEnabledProperty
  • InputElement.IsEffectivelyEnabledProperty
  • InputElement.CursorProperty
  • InputElement.IsKeyboardFocusWithinProperty
  • InputElement.IsFocusedProperty
  • InputElement.IsHitTestVisibleProperty
  • InputElement.IsPointerOverProperty
  • InputElement.IsTabStopProperty
  • InputElement.GotFocusEvent
  • InputElement.LostFocusEvent
  • InputElement.KeyDownEvent
  • InputElement.KeyUpEvent
  • InputElement.TabIndexProperty
  • InputElement.TextInputEvent
  • InputElement.TextInputMethodClientRequestedEvent
  • InputElement.PointerEnteredEvent
  • InputElement.PointerExitedEvent
  • InputElement.PointerMovedEvent
  • InputElement.PointerPressedEvent
  • InputElement.PointerReleasedEvent
  • InputElement.PointerCaptureLostEvent
  • InputElement.PointerWheelChangedEvent
  • InputElement.TappedEvent
  • InputElement.HoldingEvent
  • InputElement.DoubleTappedEvent
  • InputElement.Focus(NavigationMethod, KeyModifiers)
  • InputElement.OnKeyDown(KeyEventArgs)
  • InputElement.OnTextInput(TextInputEventArgs)
  • InputElement.OnPointerEntered(PointerEventArgs)
  • InputElement.OnPointerExited(PointerEventArgs)
  • InputElement.OnPointerMoved(PointerEventArgs)
  • InputElement.OnPointerPressed(PointerPressedEventArgs)
  • InputElement.OnPointerCaptureLost(PointerCaptureLostEventArgs)
  • InputElement.OnPointerWheelChanged(PointerWheelEventArgs)
  • InputElement.UpdateIsEffectivelyEnabled()
  • InputElement.Focusable
  • InputElement.IsEnabled
  • InputElement.Cursor
  • InputElement.IsKeyboardFocusWithin
  • InputElement.IsFocused
  • InputElement.IsHitTestVisible
  • InputElement.IsPointerOver
  • InputElement.IsTabStop
  • InputElement.IsEffectivelyEnabled
  • InputElement.TabIndex
  • InputElement.KeyBindings
  • InputElement.IsEnabledCore
  • InputElement.GestureRecognizers
  • InputElement.GotFocus
  • InputElement.LostFocus
  • InputElement.KeyDown
  • InputElement.KeyUp
  • InputElement.TextInput
  • InputElement.TextInputMethodClientRequested
  • InputElement.PointerEntered
  • InputElement.PointerExited
  • InputElement.PointerMoved
  • InputElement.PointerPressed
  • InputElement.PointerReleased
  • InputElement.PointerCaptureLost
  • InputElement.PointerWheelChanged
  • InputElement.Tapped
  • InputElement.Holding
  • InputElement.DoubleTapped
  • Interactive.AddHandler(RoutedEvent, Delegate, RoutingStrategies, bool)
  • Interactive.AddHandler<TEventArgs>(RoutedEvent<TEventArgs>, EventHandler<TEventArgs>, RoutingStrategies, bool)
  • Interactive.RemoveHandler(RoutedEvent, Delegate)
  • Interactive.RemoveHandler<TEventArgs>(RoutedEvent<TEventArgs>, EventHandler<TEventArgs>)
  • Interactive.RaiseEvent(RoutedEventArgs)
  • Interactive.BuildEventRoute(RoutedEvent)
  • Layoutable.DesiredSizeProperty
  • Layoutable.WidthProperty
  • Layoutable.HeightProperty
  • Layoutable.MinWidthProperty
  • Layoutable.MaxWidthProperty
  • Layoutable.MinHeightProperty
  • Layoutable.MaxHeightProperty
  • Layoutable.MarginProperty
  • Layoutable.HorizontalAlignmentProperty
  • Layoutable.VerticalAlignmentProperty
  • Layoutable.UseLayoutRoundingProperty
  • Layoutable.UpdateLayout()
  • Layoutable.Measure(Size)
  • Layoutable.Arrange(Rect)
  • Layoutable.InvalidateMeasure()
  • Layoutable.InvalidateArrange()
  • Layoutable.AffectsMeasure<T>(params AvaloniaProperty[])
  • Layoutable.AffectsArrange<T>(params AvaloniaProperty[])
  • Layoutable.MeasureCore(Size)
  • Layoutable.MeasureOverride(Size)
  • Layoutable.ArrangeCore(Rect)
  • Layoutable.ArrangeOverride(Size)
  • Layoutable.OnMeasureInvalidated()
  • Layoutable.OnVisualParentChanged(Visual, Visual)
  • Layoutable.Width
  • Layoutable.Height
  • Layoutable.MinWidth
  • Layoutable.MaxWidth
  • Layoutable.MinHeight
  • Layoutable.MaxHeight
  • Layoutable.Margin
  • Layoutable.HorizontalAlignment
  • Layoutable.VerticalAlignment
  • Layoutable.DesiredSize
  • Layoutable.IsMeasureValid
  • Layoutable.IsArrangeValid
  • Layoutable.UseLayoutRounding
  • Layoutable.EffectiveViewportChanged
  • Layoutable.LayoutUpdated
  • Visual.BoundsProperty
  • Visual.ClipToBoundsProperty
  • Visual.ClipProperty
  • Visual.IsVisibleProperty
  • Visual.OpacityProperty
  • Visual.OpacityMaskProperty
  • Visual.EffectProperty
  • Visual.HasMirrorTransformProperty
  • Visual.RenderTransformProperty
  • Visual.RenderTransformOriginProperty
  • Visual.FlowDirectionProperty
  • Visual.VisualParentProperty
  • Visual.ZIndexProperty
  • Visual.GetFlowDirection(Visual)
  • Visual.SetFlowDirection(Visual, FlowDirection)
  • Visual.InvalidateVisual()
  • Visual.Render(DrawingContext)
  • Visual.AffectsRender<T>(params AvaloniaProperty[])
  • Visual.LogicalChildrenCollectionChanged(object, NotifyCollectionChangedEventArgs)
  • Visual.OnAttachedToVisualTree(VisualTreeAttachmentEventArgs)
  • Visual.OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs)
  • Visual.InvalidateMirrorTransform()
  • Visual.Bounds
  • Visual.ClipToBounds
  • Visual.Clip
  • Visual.IsEffectivelyVisible
  • Visual.IsVisible
  • Visual.Opacity
  • Visual.OpacityMask
  • Visual.Effect
  • Visual.HasMirrorTransform
  • Visual.RenderTransform
  • Visual.RenderTransformOrigin
  • Visual.FlowDirection
  • Visual.ZIndex
  • Visual.VisualChildren
  • Visual.VisualRoot
  • Visual.BypassFlowDirectionPolicies
  • Visual.AttachedToVisualTree
  • Visual.DetachedFromVisualTree
  • StyledElement.DataContextProperty
  • StyledElement.NameProperty
  • StyledElement.ParentProperty
  • StyledElement.TemplatedParentProperty
  • StyledElement.ThemeProperty
  • StyledElement.BeginInit()
  • StyledElement.EndInit()
  • StyledElement.ApplyStyling()
  • StyledElement.InitializeIfNeeded()
  • StyledElement.TryGetResource(object, ThemeVariant, out object)
  • StyledElement.OnDataContextChanged(EventArgs)
  • StyledElement.OnDataContextBeginUpdate()
  • StyledElement.OnDataContextEndUpdate()
  • StyledElement.OnInitialized()
  • StyledElement.Name
  • StyledElement.Classes
  • StyledElement.DataContext
  • StyledElement.IsInitialized
  • StyledElement.Styles
  • StyledElement.StyleKey
  • StyledElement.Resources
  • StyledElement.TemplatedParent
  • StyledElement.Theme
  • StyledElement.LogicalChildren
  • StyledElement.PseudoClasses
  • StyledElement.StyleKeyOverride
  • StyledElement.Parent
  • StyledElement.ActualThemeVariant
  • StyledElement.AttachedToLogicalTree
  • StyledElement.DetachedFromLogicalTree
  • StyledElement.DataContextChanged
  • StyledElement.Initialized
  • StyledElement.ResourcesChanged
  • StyledElement.ActualThemeVariantChanged
  • Animatable.TransitionsProperty
  • Animatable.OnPropertyChangedCore(AvaloniaPropertyChangedEventArgs)
  • Animatable.Transitions
  • AvaloniaObject.CheckAccess()
  • AvaloniaObject.VerifyAccess()
  • AvaloniaObject.ClearValue(AvaloniaProperty)
  • AvaloniaObject.ClearValue<T>(AvaloniaProperty<T>)
  • AvaloniaObject.ClearValue<T>(StyledProperty<T>)
  • AvaloniaObject.ClearValue<T>(DirectPropertyBase<T>)
  • AvaloniaObject.Equals(object)
  • AvaloniaObject.GetHashCode()
  • AvaloniaObject.GetValue(AvaloniaProperty)
  • AvaloniaObject.GetValue<T>(StyledProperty<T>)
  • AvaloniaObject.GetValue<T>(DirectPropertyBase<T>)
  • AvaloniaObject.GetBaseValue<T>(StyledProperty<T>)
  • AvaloniaObject.IsAnimating(AvaloniaProperty)
  • AvaloniaObject.IsSet(AvaloniaProperty)
  • AvaloniaObject.SetValue(AvaloniaProperty, object, BindingPriority)
  • AvaloniaObject.SetValue<T>(StyledProperty<T>, T, BindingPriority)
  • AvaloniaObject.SetValue<T>(DirectPropertyBase<T>, T)
  • AvaloniaObject.SetCurrentValue(AvaloniaProperty, object)
  • AvaloniaObject.SetCurrentValue<T>(StyledProperty<T>, T)
  • AvaloniaObject.Bind(AvaloniaProperty, IBinding)
  • AvaloniaObject.Bind(AvaloniaProperty, IObservable<object>, BindingPriority)
  • AvaloniaObject.Bind<T>(StyledProperty<T>, IObservable<object>, BindingPriority)
  • AvaloniaObject.Bind<T>(StyledProperty<T>, IObservable<T>, BindingPriority)
  • AvaloniaObject.Bind<T>(StyledProperty<T>, IObservable<BindingValue<T>>, BindingPriority)
  • AvaloniaObject.Bind<T>(DirectPropertyBase<T>, IObservable<object>)
  • AvaloniaObject.Bind<T>(DirectPropertyBase<T>, IObservable<T>)
  • AvaloniaObject.Bind<T>(DirectPropertyBase<T>, IObservable<BindingValue<T>>)
  • AvaloniaObject.CoerceValue(AvaloniaProperty)
  • AvaloniaObject.UpdateDataValidation(AvaloniaProperty, BindingValueType, Exception)
  • AvaloniaObject.RaisePropertyChanged<T>(DirectPropertyBase<T>, T, T)
  • AvaloniaObject.SetAndRaise<T>(DirectPropertyBase<T>, ref T, T)
  • AvaloniaObject.InheritanceParent
  • AvaloniaObject.this[AvaloniaProperty]
  • AvaloniaObject.this[IndexerDescriptor]
  • AvaloniaObject.PropertyChanged
  • object.GetType()
  • object.MemberwiseClone()
  • object.Equals(object, object)
  • object.ReferenceEquals(object, object)

Extension Methods