Page.TopAppBar Property


Gets a reference to an AppBar displayed at the top of the page, if any.

Equivalent WinUI property: Microsoft.UI.Xaml.Controls.Page.TopAppBar.

AppBar TopAppBar();

void TopAppBar(AppBar value);
public AppBar TopAppBar { get; set; }
var appBar = page.topAppBar;
page.topAppBar = appBar;
Public Property TopAppBar As AppBar
<Page ...>
    <AppBar .../>

Property Value


A reference to an AppBar displayed at the top of the page, or null.


For example code that adds an AppBar to a page, see Quickstart: adding app bars or How to share an app bar across pages. For a complete sample that uses many of the Page and Frame features together, see XAML Navigation sample.


In XAML, make sure you specify the Page.TopAppBar property element in the same area as other property elements that may already be defined, like Page.BottomAppBar or Page.Resources. The XAML language enforces that you can't mix the property elements between the XAML content that is setting Content, such as the typical root Grid element. For more info on XAML syntax, see XAML syntax guide.

Applies to

See also