InfoBar Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
An InfoBar is an inline notification for essential app-wide messages. The InfoBar will take up space in a layout and will not cover up other content or float on top of it. It supports rich content (including titles, messages, icons, and buttons) and can be configured to be user-dismissable or persistent.
This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).
/// [Microsoft.UI.Xaml.CustomAttributes.MUXContractProperty(version=0)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Version(1)]
/// [Windows.UI.Xaml.Markup.ContentProperty(Name="Content")]
class InfoBar : Control
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.UI.Xaml.Markup.ContentProperty(Name="Content")]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.XamlContract, 65536)]
class InfoBar : Control
[Microsoft.UI.Xaml.CustomAttributes.MUXContractProperty(version=0)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Version(1)]
[Windows.UI.Xaml.Markup.ContentProperty(Name="Content")]
public class InfoBar : Control
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.UI.Xaml.Markup.ContentProperty(Name="Content")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.XamlContract), 65536)]
public class InfoBar : Control
Public Class InfoBar
Inherits Control
- Inheritance
-
InfoBar
- Attributes
-
Microsoft.UI.Xaml.CustomAttributes.MUXContractPropertyAttribute MarshalingBehaviorAttribute ThreadingAttribute VersionAttribute ContentPropertyAttribute ContractVersionAttribute
Examples
Tip
For more info, design guidance, and code examples, see Infobar.
The WinUI 2 Gallery app includes interactive examples of most WinUI 2 controls, features, and functionality. Get the app from the Microsoft Store or get the source code on GitHub.
Remarks
Use an InfoBar control when a user should be informed of, acknowledge, or take action on a changed application state. The changed state should impact app perception or experience for the user.
Control style and template
You can modify the default Style and ControlTemplate to give the control a unique appearance. For information about modifying a control's style and template, see Styling controls. The default style, template, and resources that define the look of the control are included in the generic.xaml file. For design purposes, generic.xaml is available in the (Program Files)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\ <SDK version>\Generic folder from a Windows Software Development Kit (SDK) installation. Styles and resources from different versions of the SDK might have different values.
Starting in Windows 10, version 1607 (SDK 14393), generic.xaml includes resources that you can use to modify the colors of a control in different visual states without modifying the control template. In apps that target this software development kit (SDK) or later, modifying these resources is preferred to setting properties such as Background and Foreground. For more info, see the Light-weight styling section of the Styling controls article.
This table shows the resources used by the InfoBar control.
All Theme Resources
| Resource Key | Description |
|---|---|
| InfoBarErrorSeverityBackgroundBrush | Error Severity background color |
| InfoBarWarningSeverityBackgroundBrush | Warning Severity background color |
| InfoBarSuccessSeverityBackgroundBrush | Success Severity background color |
| InfoBarInformationalSeverityBackgroundBrush | Informational Severity background color |
| InfoBarErrorSeverityIconBackground | Error Severity icon background color |
| InfoBarWarningSeverityIconBackground | Warning Severity icon background color |
| InfoBarSuccessSeverityIconBackground | Success Severity icon background color |
| InfoBarInformationalSeverityIconBackground | Informational Severity icon background color |
| InfoBarErrorSeverityIconForeground | Error Severity icon foreground color |
| InfoBarWarningSeverityIconForeground | Warning Severity foreground icon color |
| InfoBarSuccessSeverityIconForeground | Success Severity foreground icon color |
| InfoBarInformationalSeverityIconForeground | Informational Severity foreground icon color |
| InfoBarTitleForeground | Title text color |
| InfoBarMessageForeground | Message text color |
| InfoBarHyperlinkButtonForeground | Hyperlink button text color |
| InfoBarBorderBrush | Border color |
| InfoBarBorderThickness | Border thickness |
| InfoBarTitleFontSize | Title text font size |
| InfoBarTitleFontWeight | Title text font weight |
| InfoBarMessageFontSize | Message text font size |
| InfoBarMessageFontWeight | Message text font weight |
| InfoBarMinHeight | Minimum height of InfoBar |
| InfoBarCloseButtonSize | Close button size |
| InfoBarCloseButtonGlyphSize | Close button glyph size |
| InfoBarHyperlinkButtonMargin | Hyperlink button margin thickness |
| InfoBarIconBackgroundGlyph | Background glyph behind each default icon |
| InfoBarInformationalIconGlyph | Informational Severity icon glyph |
| InfoBarErrorIconGlyph | Error Severity icon glyph |
| InfoBarWarningIconGlyph | Warning Severity icon glyph |
| InfoBarSuccessIconGlyph | Success Severity icon glyph |
| InfoBarContentRootPadding | Padding thickness for Content property |
| InfoBarIconMargin | Icon margin thickness |
| InfoBarIconFontSize | Icon font size |
| InfoBarPanelMargin | Panel margin thickness |
| InfoBarPanelHorizontalOrientationPadding | Panel padding in horizontal, single-line layout |
| InfoBarPanelVerticalOrientationPadding | Panel padding in vertical, multiline layout |
| InfoBarTitleHorizontalOrientationMargin | Title margin thickness in the horizontal, single-line layout |
| InfoBarTitleVerticalOrientationMargin | Title margin thickness in the vertical, multiline layout |
| InfoBarMessageHorizontalOrientationMargin | Message margin thickness in the horizontal, single-line layout |
| InfoBarMessageVerticalOrientationMargin | Message margin thickness in the vertical, multiline layout |
| InfoBarActionHorizontalOrientationMargin | Action content margin thickness in the horizontal, single-line layout |
| InfoBarActionVerticalOrientationMargin | Action content margin thickness in the vertical, multiline layout |
| InfoBarCloseButtonSymbol | Close button symbol glyph |
| InfoBarCloseButtonStyle | Close button style |
Constructors
| InfoBar() |
Initializes a new instance of the InfoBar class. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
Properties
| ActionButton |
Gets or sets the action button of the InfoBar. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| ActionButtonProperty |
Identifies the ActionButton dependency property. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| CloseButtonCommand |
Gets or sets the command to invoke when the close button is clicked in the InfoBar. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| CloseButtonCommandParameter |
Gets or sets the parameter to pass to the command for the close button in the InfoBar. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| CloseButtonCommandParameterProperty |
Identifies the CloseButtonCommandParameter dependency property. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| CloseButtonCommandProperty |
Identifies the CloseButtonCommand dependency property. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| CloseButtonStyle |
Gets or sets the This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| CloseButtonStyleProperty |
Identifies the CloseButtonStyle dependency property. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| Content |
Gets or sets the XAML Content that is displayed below the title and message in the InfoBar. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| ContentProperty |
Identifies the Content dependency property. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| ContentTemplate |
Gets or sets the data template for the InfoBar.Content. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| ContentTemplateProperty |
Identifies the ContentTemplate dependency property. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| IconSource |
Gets or sets the graphic content to appear alongside the title and message in the InfoBar. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| IconSourceProperty |
Identifies the IconSource dependency property. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| IsClosable |
Gets or sets a value that indicates whether the user can close the InfoBar. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| IsClosableProperty |
Identifies the IsClosable dependency property. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| IsIconVisible |
Gets or sets a value that indicates whether the icon is visible in the InfoBar. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| IsIconVisibleProperty |
Identifies the IsIconVisible dependency property. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| IsOpen |
Gets or sets a value that indicates whether the InfoBar is open. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| IsOpenProperty |
Identifies the IsOpen dependency property. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| Message |
Gets or sets the message of the InfoBar. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| MessageProperty |
Identifies the Message dependency property. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| Severity |
Gets or sets the type of the InfoBar to apply consistent status color, icon, and assistive technology settings dependent on the criticality of the notification. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| SeverityProperty |
Identifies the Severity dependency property. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| TemplateSettings |
Provides calculated values that can be referenced as TemplatedParent sources when defining templates for an InfoBar. Not intended for general use. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| TemplateSettingsProperty |
Identifies the TemplateSettings dependency property. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| Title |
Gets or sets the title of the InfoBar. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| TitleProperty |
Identifies the Title dependency property. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
Events
| CloseButtonClick |
Occurs after the close button is clicked in the InfoBar. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| Closed |
Occurs after the InfoBar is closed. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
| Closing |
Occurs just before the InfoBar begins to close. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
Applies to
See also
피드백
다음에 대한 사용자 의견 제출 및 보기