Skip to main content

InfoBar

C# API / Fluence.Wpf.Controls

  • Assembly: Fluence.Wpf
  • Namespace: Fluence.Wpf.Controls
public class InfoBar : ContentControl

An inline notification bar for displaying status messages with severity levels.

Base type: ContentControl (including inherited WPF and .NET members)

C# source

Constructors​

InfoBar​

public InfoBar()

Creates a new InfoBar instance.

Properties​

ActionButton​

public object ActionButton { get; set; }

Gets or sets the content placed in the action button slot.

CloseButtonCommand​

public ICommand? CloseButtonCommand { get; set; }

Gets or sets the command invoked when the close button is clicked, WinUI's InfoBar.CloseButtonCommand. The command runs in addition to the close itself: the bar still closes unless a Closing handler cancels it.

CloseButtonCommandParameter​

public object? CloseButtonCommandParameter { get; set; }

Gets or sets the parameter passed to CloseButtonCommand.

CloseButtonStyle​

public Style? CloseButtonStyle { get; set; }

Gets or sets the style applied to the close button, WinUI's InfoBar.CloseButtonStyle.

CornerRadius​

public CornerRadius CornerRadius { get; set; }

Gets or sets the corner radius of the info bar.

Icon​

public object Icon { get; set; }

Gets or sets a custom icon that overrides the default severity icon.

IsClosable​

public bool IsClosable { get; set; }

Gets or sets a value indicating whether the close button is displayed.

IsIconVisible​

public bool IsIconVisible { get; set; }

Gets or sets a value indicating whether the severity icon is displayed.

IsOpen​

public bool IsOpen { get; set; }

Gets or sets a value indicating whether the info bar is visible. The default is false, as WinUI's is: a bar is declared closed and opened when the condition it reports actually arises.

Message​

public string Message { get; set; }

Gets or sets the message text displayed in the info bar.

Severity​

public InfoBarSeverity Severity { get; set; }

Gets or sets the severity level that determines the visual style of the info bar.

Title​

public string Title { get; set; }

Gets or sets the title text displayed in the info bar.

Methods​

GetSeverityBrushKey​

public static string GetSeverityBrushKey(InfoBarSeverity severity)

Returns the theme brush resource key (for a DynamicResource reference) that colors severity. Mirrors the Severity triggers in Themes/Controls/InfoBar.xaml.

Parameter severity: The severity to map.

Returns: A brush key resolvable against the Fluence theme dictionaries.

Exception System.ArgumentOutOfRangeException: Thrown when severity is not a defined InfoBarSeverity value.

GetSeverityGlyph​

public static string GetSeverityGlyph(InfoBarSeverity severity)

Returns the Segoe Fluent Icons glyph that represents severity. This is the single programmatic source for the severity glyphs; it mirrors the StandardIcon severity triggers in Themes/Controls/InfoBar.xaml (WPF property triggers cannot call this method, so keep both in sync). These are the WinUI InfoBar*IconGlyph codes (InfoBar_themeresources.xaml), the glyph drawn on top of the IconBackground circle, not a standalone icon.

Parameter severity: The severity to map.

Returns: A single-character glyph string in the Segoe Fluent Icons font.

Exception System.ArgumentOutOfRangeException: Thrown when severity is not a defined InfoBarSeverity value.

OnApplyTemplate​

public override void OnApplyTemplate()

Documentation inherited from the ContentControl API.

OnCloseButtonClick​

protected virtual void OnCloseButtonClick()

Stamps CloseButton as the reason for the close the button is about to start, then drives IsOpen to false. The Closing and Closed events are raised by the property's changed callback, so a cancelled close leaves the bar open and a completed one raises Closed once, with this reason.

OnCreateAutomationPeer​

protected override AutomationPeer OnCreateAutomationPeer()

Documentation inherited from the ContentControl API.

Events​

CloseButtonClick​

public event EventHandler? CloseButtonClick

Occurs when the close button is clicked, before the close itself runs, matching WinUI's InfoBar.CloseButtonClick. WinUI passes no arguments of its own here, so neither does this. Cancel the close from Closing, not from here.

Closed​

public event EventHandler<InfoBarClosedEventArgs>? Closed

Occurs after the info bar has closed.

Closing​

public event EventHandler<InfoBarClosingEventArgs>? Closing

Occurs before the info bar closes, whichever way the close started: the close button or IsOpen set to false in code. Set Cancel to true to prevent closing; IsOpen goes back to true and Closed is not raised.

Opened​

public event EventHandler<InfoBarOpenedEventArgs>? Opened

Occurs when the info bar opens, which is IsOpen going from false to true. WinUI raises the same event from the same transition. A Closing handler that cancels puts IsOpen back without the bar ever having closed, and that revert is not a fresh open, so it raises nothing here.

Dependency property identifiers​

Use these identifiers with WPF property APIs. The matching CLR properties appear above when the control exposes them.

ActionButtonProperty​

public static readonly DependencyProperty ActionButtonProperty

Identifies the ActionButton dependency property.

CloseButtonCommandParameterProperty​

public static readonly DependencyProperty CloseButtonCommandParameterProperty

Identifies the CloseButtonCommandParameter dependency property.

CloseButtonCommandProperty​

public static readonly DependencyProperty CloseButtonCommandProperty

Identifies the CloseButtonCommand dependency property.

CloseButtonStyleProperty​

public static readonly DependencyProperty CloseButtonStyleProperty

Identifies the CloseButtonStyle dependency property.

CornerRadiusProperty​

public static readonly DependencyProperty CornerRadiusProperty

Identifies the CornerRadius dependency property.

IconProperty​

public static readonly DependencyProperty IconProperty

Identifies the Icon dependency property.

IsClosableProperty​

public static readonly DependencyProperty IsClosableProperty

Identifies the IsClosable dependency property.

IsIconVisibleProperty​

public static readonly DependencyProperty IsIconVisibleProperty

Identifies the IsIconVisible dependency property.

IsOpenProperty​

public static readonly DependencyProperty IsOpenProperty

Identifies the IsOpen dependency property.

MessageProperty​

public static readonly DependencyProperty MessageProperty

Identifies the Message dependency property.

SeverityProperty​

public static readonly DependencyProperty SeverityProperty

Identifies the Severity dependency property.

TitleProperty​

public static readonly DependencyProperty TitleProperty

Identifies the Title dependency property.