In This Article

InfoBar Class

Displays a bar with information of varying severity.

[TemplatePart(Name = "PART_ActionPresenter", Type = typeof(ContentPresenter))]
[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(FrameworkElement))]
[TemplatePart(Name = "PART_TitleElement", Type = typeof(FrameworkElement))]
public class InfoBar : ContentControl
Inheritance:
object Visual UIElement FrameworkElement Control ContentControl object

Constructors

InfoBar()

Initializes a new instance of the class.

public InfoBar()

Properties

Action

Gets or sets the content for the action.

public object? Action { get; set; }

Property Value

object

ActionTemplate

Gets or sets the template used to display the Action.

public DataTemplate ActionTemplate { get; set; }

Property Value

DataTemplate

ActionTemplateSelector

Gets or sets the DataTemplateSelector to use for the Action.

public DataTemplateSelector ActionTemplateSelector { get; set; }

Property Value

DataTemplateSelector:

The DataTemplateSelector to use for the Action.

CanClose

Gets or sets if the control can be closed.

public bool CanClose { get; set; }

Property Value

bool:

true if the control can be closed; otherwise false. The default value is true.

CloseButtonCommand

Gets or sets the command associated with the close button.

public ICommand? CloseButtonCommand { get; set; }

Property Value

ICommand

See Also

CloseButtonCommandParameter

Gets or sets the parameter to be passed to the CloseButtonCommand.

public object? CloseButtonCommandParameter { get; set; }

Property Value

object

See Also

CloseButtonStyle

Gets or sets the Style applied to the close button.

public Style CloseButtonStyle { get; set; }

Property Value

Style

CornerRadius

Gets or sets the CornerRadius applied to the control.

public CornerRadius CornerRadius { get; set; }

Property Value

CornerRadius:

A CornerRadius.

HasAction

Indicates whether Action has a non-null value.

public bool HasAction { get; }

Property Value

bool

HasMessage

Indicates whether Message has a non-null value.

public bool HasMessage { get; }

Property Value

bool

HasTitle

Indicates whether Title has a non-null value.

public bool HasTitle { get; }

Property Value

bool

HorizontalSpacing

Gets or sets 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

Gets or sets the content for the icon.

public object? Icon { get; set; }

Property Value

object

IconTemplate

Gets or sets the template used to display the Icon.

public DataTemplate IconTemplate { get; set; }

Property Value

DataTemplate

IconTemplateSelector

Gets or sets the DataTemplateSelector to use for the Icon.

public DataTemplateSelector IconTemplateSelector { get; set; }

Property Value

DataTemplateSelector:

The DataTemplateSelector to use for the Icon.

IsAnimationEnabled

Gets or sets whether animations are enabled for an element, when supported.

public bool IsAnimationEnabled { get; set; }

Property Value

bool:

true if animations are enabled; otherwise, false. The default value is true.

IsIconVisible

Gets or sets if the icon is visible.

public bool IsIconVisible { get; set; }

Property Value

bool:

true if the icon should be visible; otherwise, false if the icon should not be visible. The default value is true.

IsOpen

Gets or sets 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 Visibility property to control if the info bar is displayed.

IsWrapped

Gets whether the layout is wrapped to multiple lines.

public bool IsWrapped { get; }

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

Gets or sets the message.

public string? Message { get; set; }

Property Value

string

Severity

Gets or sets the severity of the message.

public InfoBarSeverity Severity { get; set; }

Property Value

InfoBarSeverity:

One of the InfoBarSeverity values. The default value is Information.

Title

Gets or sets the title.

public string? Title { get; set; }

Property Value

string

VerticalSpacing

Gets or sets the amount of vertical spacing that appears between controls.

public double VerticalSpacing { get; set; }

Property Value

double:

The default value is 10.

Methods

OnApplyTemplate()

When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().

public override void OnApplyTemplate()

OnCreateAutomationPeer()

Returns class-specific AutomationPeer implementations for the Windows Presentation Foundation (WPF) infrastructure.

protected override AutomationPeer OnCreateAutomationPeer()

Returns

AutomationPeer:

The type-specific AutomationPeer implementation.

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>

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

Identifies the Action dependency property.

public static readonly DependencyProperty ActionProperty

ActionTemplateProperty

Identifies the ActionTemplate dependency property.

public static readonly DependencyProperty ActionTemplateProperty

ActionTemplateSelectorProperty

Identifies the ActionTemplateSelector dependency property.

public static readonly DependencyProperty ActionTemplateSelectorProperty

CanCloseProperty

Identifies the CanClose dependency property.

public static readonly DependencyProperty CanCloseProperty

CloseButtonCommandParameterProperty

Identifies the CloseButtonCommandParameter dependency property.

public static readonly DependencyProperty CloseButtonCommandParameterProperty

CloseButtonCommandProperty

Identifies the CloseButtonCommand dependency property.

public static readonly DependencyProperty CloseButtonCommandProperty

CloseButtonStyleProperty

Identifies the CloseButtonStyle dependency property.

public static readonly DependencyProperty CloseButtonStyleProperty

CornerRadiusProperty

Identifies the CornerRadius dependency property.

public static readonly DependencyProperty CornerRadiusProperty

HasActionProperty

Identifies the read-only HasAction dependency property.

public static readonly DependencyProperty HasActionProperty

HasMessageProperty

Identifies the read-only HasMessage dependency property.

public static readonly DependencyProperty HasMessageProperty

HasTitleProperty

Identifies the read-only HasTitle dependency property.

public static readonly DependencyProperty HasTitleProperty

HorizontalSpacingProperty

Identifies the HorizontalSpacing property.

public static readonly DependencyProperty HorizontalSpacingProperty

IconProperty

Identifies the Icon dependency property.

public static readonly DependencyProperty IconProperty

IconTemplateProperty

Identifies the IconTemplate dependency property.

public static readonly DependencyProperty IconTemplateProperty

IconTemplateSelectorProperty

Identifies the IconTemplateSelector dependency property.

public static readonly DependencyProperty IconTemplateSelectorProperty

IsAnimationEnabledProperty

Identifies the IsAnimationEnabled dependency property.

public static readonly DependencyProperty IsAnimationEnabledProperty

IsIconVisibleProperty

Identifies the IsIconVisible dependency property.

public static readonly DependencyProperty IsIconVisibleProperty

IsOpenProperty

Identifies the IsOpen dependency property.

public static readonly DependencyProperty IsOpenProperty

IsWrappedProperty

Identifies the read-only IsWrapped dependency property.

public static readonly DependencyProperty IsWrappedProperty

MessageProperty

Identifies the Message dependency property.

public static readonly DependencyProperty MessageProperty

SeverityProperty

Identifies the Severity dependency property.

public static readonly DependencyProperty SeverityProperty

TitleProperty

Identifies the Title dependency property.

public static readonly DependencyProperty TitleProperty

VerticalSpacingProperty

Identifies the VerticalSpacing property.

public static readonly DependencyProperty VerticalSpacingProperty