AppBar
AppBar
AppBar
AppBar
Class
Definition
Represents the container control that holds app UI components for commanding and experiences. For Windows 10, see Remarks.
public : class AppBar : ContentControl, IAppBar, IAppBar2, IAppBar3, IAppBar4, IAppBarOverrides, IAppBarOverrides3public class AppBar : ContentControl, IAppBar, IAppBar2, IAppBar3, IAppBar4, IAppBarOverrides, IAppBarOverrides3Public Class AppBar Inherits ContentControl Implements IAppBar, IAppBar2, IAppBar3, IAppBar4, IAppBarOverrides, IAppBarOverrides3// This API is not available in Javascript.
<AppBar .../>
-or-
<AppBar>
content
</AppBar>
- Inheritance
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
Inherited Members
Inherited properties
Inherited events
Inherited methods
Examples
This example shows a top app bar with a group of navigation buttons and a search box.
<Page.TopAppBar>
<AppBar>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal">
<Button Content="Home" Width="140" Height="80" Click="AppBarButton_Click"/>
<Button Content="Page 1" Width="140" Height="80" Click="AppBarButton_Click"/>
<Button Content="Page 2" Width="140" Height="80" Click="AppBarButton_Click"/>
</StackPanel>
<AutoSuggestBox Grid.Column="1" Width="300" Height="50" HorizontalAlignment="Right"/>
</Grid>
</AppBar>
</Page.TopAppBar>
Remarks
Important
You should use the AppBar only when you are upgrading a Universal Windows 8 app that uses the AppBar, and need to minimize changes. For new apps in Windows 10, we recommend using the CommandBar control instead.
An app bar is a UI element that's typically used to present commands and tools to the user, but can also be used for navigation. An app bar can appear at the top of the page, at the bottom of the page, or both. By default, its shown in a minimal state. Its content is shown or hidden when the user presses the ellipsis [•••], or performs a right-click that is not otherwise handled by the app.
Here's an app bar in it's minimal state.

Here's the app bar when it's open.

You can open and close the app bar programmatically by setting the IsOpen property. You can use the Opening, Opened, Closing, and Closed events to respond to the app bar being opened or closed.
By default, the app bar is dismissed (closed) when the user interacts with the app anywhere outside of the app bar. Closing the app bar this way is called light dismiss. You can control how the app bar is dismissed by setting the IsSticky property. When the app bar is sticky, it's not closed by a light dismiss gesture. The app bar remains visible until the user right clicks or presses the ellipsis [•••].
To add an app bar in Extensible Application Markup Language (XAML), you assign an AppBar control to a Page 's TopAppBar TopAppBar or BottomAppBar property. A single app bar can be shared across multiple pages. You can add and remove commands programmatically based on the page context.
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 (Windows Software Development Kit (SDK) version 10.0.14393.0), 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 AppBar control.
| Resource key | Description |
|---|---|
| AppBarBackground | Background color at rest |
| AppBarForeground | Text color at rest |
| AppBarHighContrastBorder | Border color for high-contrast |
| AppBarEllipsisButtonBackground | Background color of ellipsis at rest |
| AppBarEllipsisButtonBackgroundPointerOver | Background color of ellipsis on hover |
| AppBarEllipsisButtonBackgroundPressed | Background color of ellipsis when pressed |
| AppBarEllipsisButtonBackgroundDisabled | Background color of ellipsis when disabled |
| AppBarEllipsisButtonForeground | Foreground color of ellipsis at rest |
| AppBarEllipsisButtonForegroundPointerOver | Foreground color of ellipsis on hover |
| AppBarEllipsisButtonForegroundPressed | Foreground color of ellipsis when pressed |
| AppBarEllipsisButtonForegroundDisabled | Foreground color of ellipsis when disabled |
| AppBarEllipsisButtonBorderBrush | Border color of ellipsis at rest |
| AppBarEllipsisButtonBorderBrushPointerOver | Border color of ellipsis on hover |
| AppBarEllipsisButtonBorderBrushPressed | Border color of ellipsis when pressed |
| AppBarEllipsisButtonBorderBrushDisabled | Border color of ellipsis when disabled |
Constructors
Properties
ClosedDisplayMode ClosedDisplayMode ClosedDisplayMode ClosedDisplayMode
Gets or sets a value that indicates whether icon buttons are displayed when the app bar is not completely open.
public : AppBarClosedDisplayMode ClosedDisplayMode { get; set; }public AppBarClosedDisplayMode ClosedDisplayMode { get; set; }Public ReadWrite Property ClosedDisplayMode As AppBarClosedDisplayMode// This API is not available in Javascript.
<AppBar ClosedDisplayMode="Compact"/>
-or-
<AppBar ClosedDisplayMode="Minimal"/>
- Value
- AppBarClosedDisplayMode AppBarClosedDisplayMode AppBarClosedDisplayMode AppBarClosedDisplayMode
A value that indicates whether icon buttons are displayed when the app bar is not completely open.
ClosedDisplayModeProperty ClosedDisplayModeProperty ClosedDisplayModeProperty ClosedDisplayModeProperty
Identifies the ClosedDisplayMode dependency property.
public : static DependencyProperty ClosedDisplayModeProperty { get; }public static DependencyProperty ClosedDisplayModeProperty { get; }Public Static ReadOnly Property ClosedDisplayModeProperty As DependencyProperty// This API is not available in Javascript.
The identifier for the ClosedDisplayMode dependency property.
IsOpen IsOpen IsOpen IsOpen
Gets or sets a value that indicates whether the AppBar is open.
public : PlatForm::Boolean IsOpen { get; set; }public bool IsOpen { get; set; }Public ReadWrite Property IsOpen As bool// This API is not available in Javascript.
<AppBar IsOpen="bool"/>
- Value
- PlatForm::Boolean bool bool bool
true if the app bar is open; otherwise, false.
Examples
<AppBar IsOpen="True">
<Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Style="{StaticResource PreviousAppBarButtonStyle}"
Click="Button_Click"/>
<Button Style="{StaticResource NextAppBarButtonStyle}"
Click="Button_Click"/>
</StackPanel>
</Grid>
</AppBar>
Remarks
How the app bar is displayed when it's open depends on the ClosedDisplayMode property setting. For more info, see App bar and command bar.
You can open and close the app bar programmatically by setting the IsOpen property. You can use the Opening, Opened, Closing, and Closed events to respond to the app bar being opened or closed.
Notes for previous versions
Windows 8 Binding to the IsOpen property doesn't have the expected results because the PropertyChanged notification doesn't occur when the property is set.
- See Also
IsOpenProperty IsOpenProperty IsOpenProperty IsOpenProperty
Identifies the IsOpen dependency property.
public : static DependencyProperty IsOpenProperty { get; }public static DependencyProperty IsOpenProperty { get; }Public Static ReadOnly Property IsOpenProperty As DependencyProperty// This API is not available in Javascript.
The identifier for the IsOpen dependency property.
IsSticky IsSticky IsSticky IsSticky
Gets or sets a value that indicates whether the AppBar does not close on light dismiss.
public : PlatForm::Boolean IsSticky { get; set; }public bool IsSticky { get; set; }Public ReadWrite Property IsSticky As bool// This API is not available in Javascript.
<AppBar IsSticky="bool" .../>
- Value
- PlatForm::Boolean bool bool bool
true if the AppBar does not close on light dismiss. false if the AppBar is hidden on light dismiss.
Examples
<AppBar IsSticky="True">
<Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Style="{StaticResource HelpAppBarButtonStyle}"
Click="Button_Click"/>
</StackPanel>
</Grid>
</AppBar>
Remarks
By default, app bars are dismissed when the user interacts with your app anywhere outside of the app bar. This is called light dismiss. To keep commands visible, you can change the dismissal mode by setting the IsSticky property to true. When an app bar is sticky, it's dismissed only when the user right-clicks, presses Windows+Z, or swipes from the top or bottom edge of the screen.
- See Also
IsStickyProperty IsStickyProperty IsStickyProperty IsStickyProperty
Identifies the IsSticky dependency property.
public : static DependencyProperty IsStickyProperty { get; }public static DependencyProperty IsStickyProperty { get; }Public Static ReadOnly Property IsStickyProperty As DependencyProperty// This API is not available in Javascript.
The identifier for the IsSticky dependency property.
LightDismissOverlayMode LightDismissOverlayMode LightDismissOverlayMode LightDismissOverlayMode
Gets or sets a value that specifies whether the area outside of a light-dismiss UI is darkened.
public : LightDismissOverlayMode LightDismissOverlayMode { get; set; }public LightDismissOverlayMode LightDismissOverlayMode { get; set; }Public ReadWrite Property LightDismissOverlayMode As LightDismissOverlayMode// This API is not available in Javascript.
<appBar LightDismissOverlayMode="lightDismissOverlayModeMemberName" />
- Value
- LightDismissOverlayMode LightDismissOverlayMode LightDismissOverlayMode LightDismissOverlayMode
A value of the enumeration that specifies whether the area outside of a light-dismiss UI is darkened. The default is Auto.
| Device family |
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v3)
|
Remarks
Transient UI, such as a MenuFlyout or secondary menu in a command bar, closes when you click or tap outside of it. This is called light-dismiss. "Overlay" refers to the area outside of a light-dismiss UI.
By default, the "overlay" is darkened on the Xbox, and not darkened on other devices families. You can set LightDismissOverlayMode to On to make your app darken the "overlay" area on all device families, or set it to Off to not darken the "overlay" area on all device families.
Version compatibility
The LightDismissOverlayMode property is not available prior to Windows 10, version 1607. If your app’s 'minimum platform version' setting in Microsoft Visual Studio is less than the 'introduced version' shown in the Requirements block later in this page, you must design and test your app to account for this. For more info, see Version adaptive code.
To avoid exceptions when your app runs on previous versions of Windows 10, do not set this property in XAML or use it without performing a runtime check. This example shows how to use the ApiInformation class to check for the presence of this property before you set it.
<CommandBar x:Name="commandBar1" Loaded="CommandBar_Loaded"/>
private void CommandBar_Loaded(object sender, RoutedEventArgs e)
{
if (ApiInformation.IsPropertyPresent("Windows.UI.Xaml.Controls.AppBar", "LightDismissOverlayMode"))
{
commandBar1.LightDismissOverlayMode = LightDismissOverlayMode.On;
}
}
LightDismissOverlayModeProperty LightDismissOverlayModeProperty LightDismissOverlayModeProperty LightDismissOverlayModeProperty
Identifies the LightDismissOverlayMode dependency property.
public : static DependencyProperty LightDismissOverlayModeProperty { get; }public static DependencyProperty LightDismissOverlayModeProperty { get; }Public Static ReadOnly Property LightDismissOverlayModeProperty As DependencyProperty// This API is not available in Javascript.
The identifier for the LightDismissOverlayMode dependency property.
| Device family |
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v3)
|
TemplateSettings TemplateSettings TemplateSettings TemplateSettings
Gets an object that provides calculated values that can be referenced as {TemplateBinding} markup extension sources when defining templates for an AppBar control.
public : AppBarTemplateSettings TemplateSettings { get; }public AppBarTemplateSettings TemplateSettings { get; }Public ReadOnly Property TemplateSettings As AppBarTemplateSettings// This API is not available in Javascript.
An object that provides calculated values for templates.
Methods
OnClosed(Object) OnClosed(Object) OnClosed(Object) OnClosed(Object)
Invoked when the AppBar changes from visible to hidden.
protected : virtual void OnClosed(PlatForm::Object e)protected virtual void OnClosed(Object e)Protected Overridable Function OnClosed(e As Object) As void// This API is not available in Javascript.
- e
- PlatForm::Object Object Object Object
Event data for the event.
OnClosing(Object) OnClosing(Object) OnClosing(Object) OnClosing(Object)
Invoked when the AppBar starts to change from visible to hidden.
protected : virtual void OnClosing(PlatForm::Object e)protected virtual void OnClosing(Object e)Protected Overridable Function OnClosing(e As Object) As void// This API is not available in Javascript.
- e
- PlatForm::Object Object Object Object
Event data for the event.
OnOpened(Object) OnOpened(Object) OnOpened(Object) OnOpened(Object)
Invoked when the AppBar changes from hidden to visible, or is first displayed.
protected : virtual void OnOpened(PlatForm::Object e)protected virtual void OnOpened(Object e)Protected Overridable Function OnOpened(e As Object) As void// This API is not available in Javascript.
- e
- PlatForm::Object Object Object Object
Event data for the event.
OnOpening(Object) OnOpening(Object) OnOpening(Object) OnOpening(Object)
Invoked when the AppBar starts to change from hidden to visible, or starts to be first displayed.
protected : virtual void OnOpening(PlatForm::Object e)protected virtual void OnOpening(Object e)Protected Overridable Function OnOpening(e As Object) As void// This API is not available in Javascript.
- e
- PlatForm::Object Object Object Object
Event data for the event.
Events
Closed Closed Closed Closed
Occurs when the AppBar changes from visible to hidden.
public : event EventHandler Closed<object>public event EventHandler Closed<object>Public Event Closed<object>// This API is not available in Javascript.
<AppBar Closed="eventhandler"/>
Remarks
You can respond to the app bar being dismissed by handling the Closed event.
- See Also
Closing Closing Closing Closing
Occurs when the AppBar starts to change from visible to hidden.
public : event EventHandler Closing<object>public event EventHandler Closing<object>Public Event Closing<object>// This API is not available in Javascript.
<AppBar Closing="eventhandler"/>
Opened Opened Opened Opened
Occurs when the AppBar changes from hidden to visible.
public : event EventHandler Opened<object>public event EventHandler Opened<object>Public Event Opened<object>// This API is not available in Javascript.
<AppBar Opened="eventhandler"/>
Remarks
You can respond to the app bar being opened by handling the Opened event.
- See Also