In This Article

InfoBar Class

Displays a bar with information of varying severity.

[TemplatePart(Name = "PART_CloseButton", Type = typeof(Button))]
[TemplatePart(Name = "PART_ContentPresenter", Type = typeof(ContentPresenter))]
[TemplatePart(Name = "PART_IconPresenter", Type = typeof(ContentPresenter))]
[TemplatePart(Name = "PART_ActionPresenter", 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 an instance of the class.

public InfoBar()

Properties

Action

The content for the action.

public object? Action { get; set; }

Property Value

object

ActionTemplate

The template used to display the Action.

public DataTemplate? ActionTemplate { get; set; }

Property Value

DataTemplate

ActionTemplateSelector

The DataTemplateSelector to use for the Action.

public DataTemplateSelector? ActionTemplateSelector { get; set; }

Property Value

DataTemplateSelector

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

CloseButtonStyle

The Style applied to the close button.

public Style? CloseButtonStyle { get; set; }

Property Value

Style

CornerRadius

The CornerRadius applied to the control.

public CornerRadius CornerRadius { get; set; }

Property Value

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, 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.

public object? Icon { get; set; }

Property Value

object

IconTemplate

The template used to display the Icon.

public DataTemplate? IconTemplate { get; set; }

Property Value

DataTemplate

IconTemplateSelector

The DataTemplateSelector to use for the Icon.

public DataTemplateSelector? IconTemplateSelector { get; set; }

Property Value

DataTemplateSelector

IsAnimationEnabled

Indicates whether animations are enabled for an element, when supported.

public bool IsAnimationEnabled { get; set; }

Property Value

bool:

The default value is true.

IsIconVisible

Indicates whether 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

Indicates whether 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.

IsSingleLineAllowed

Indicates if a single-line display is allowed or if controls should always be wrapped.

public bool IsSingleLineAllowed { get; set; }

Property Value

bool:

true to allow a single-line display when space is available; otherwise, false to force a wrapped layout. The default value is true.

IsWrapped

Indicates 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

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()

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>

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 DependencyProperty ActionProperty

ActionTemplateProperty

Defines the ActionTemplate property.

public static readonly DependencyProperty ActionTemplateProperty

ActionTemplateSelectorProperty

Defines the ActionTemplateSelector property.

public static readonly DependencyProperty ActionTemplateSelectorProperty

CanCloseProperty

Defines the CanClose property.

public static readonly DependencyProperty CanCloseProperty

CloseButtonCommandParameterProperty

Defines the CloseButtonCommandParameter property.

public static readonly DependencyProperty CloseButtonCommandParameterProperty

CloseButtonCommandProperty

Defines the CloseButtonCommand property.

public static readonly DependencyProperty CloseButtonCommandProperty

CloseButtonStyleProperty

Defines the CloseButtonStyle property.

public static readonly DependencyProperty CloseButtonStyleProperty

CornerRadiusProperty

Defines the CornerRadius property.

public static readonly DependencyProperty CornerRadiusProperty

HasActionProperty

Defines the HasAction property.

public static readonly DependencyProperty HasActionProperty

HasMessageProperty

Defines the HasMessage property.

public static readonly DependencyProperty HasMessageProperty

HasTitleProperty

Defines the HasTitle property.

public static readonly DependencyProperty HasTitleProperty

HorizontalSpacingProperty

Defines the HorizontalSpacing property.

public static readonly DependencyProperty HorizontalSpacingProperty

IconProperty

Defines the Icon property.

public static readonly DependencyProperty IconProperty

IconTemplateProperty

Defines the IconTemplate property.

public static readonly DependencyProperty IconTemplateProperty

IconTemplateSelectorProperty

Defines the IconTemplateSelector property.

public static readonly DependencyProperty IconTemplateSelectorProperty

IsAnimationEnabledProperty

Defines the IsAnimationEnabled property.

public static readonly DependencyProperty IsAnimationEnabledProperty

IsIconVisibleProperty

Defines the IsIconVisible property.

public static readonly DependencyProperty IsIconVisibleProperty

IsOpenProperty

Defines the IsOpen property.

public static readonly DependencyProperty IsOpenProperty

IsSingleLineAllowedProperty

Defines the IsSingleLineAllowed property.

public static readonly DependencyProperty IsSingleLineAllowedProperty

IsWrappedProperty

Defines the IsWrapped property.

public static readonly DependencyProperty IsWrappedProperty

MessageProperty

Defines the Message property.

public static readonly DependencyProperty MessageProperty

SeverityProperty

Defines the Severity property.

public static readonly DependencyProperty SeverityProperty

TitleProperty

Defines the Title property.

public static readonly DependencyProperty TitleProperty

VerticalSpacingProperty

Defines the VerticalSpacing property.

public static readonly DependencyProperty VerticalSpacingProperty

Extension Methods