UWP Tips &Tricks #1 – AppBar and Default Behavior

By default , the AppBar is hidden in your Windows 8.1 app . When using the AppBar in your Universal Windows App (UWP) , the appbar is not hidden by default.

How to hide/show the AppBar in Universal Windows App ?

You can use the AppBar.ClosedDisplayMode property to hide or show the AppBar.

For example , adding the below code to create the AppBar in Windows 10 app (Figure 2) and Windows 8.1 (Figure 1) would result with the following.

<Page.BottomAppBar>
    <AppBar>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <StackPanel Orientation="Horizontal">
                <Button Content="Button 1" Width="100" Height="40" />
                <Button Content="Button 2" Width="100" Height="40" />
            </StackPanel>
        </Grid>
    </AppBar>
</Page.BottomAppBar>

image

Figure 1- Windows 8.1 and AppBar – Hidden by default.

image

Figure 2 – Windows 10 App – Not hidden by default

You can modify this by setting the ClosedDisplayMode property of the AppBar to “Hidden”.

<Page.BottomAppBar>
    <AppBar <ClosedDisplayMode="Hidden">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <StackPanel Orientation="Horizontal">
                <Button Content="Button 1" Width="100" Height="40" />
                <Button Content="Button 2" Width="100" Height="40" />
            </StackPanel>
        </Grid>
    </AppBar>
</Page.BottomAppBar>

The ClosedDisplayMode property of the AppBar contains a value that indicates whether icon buttons are displayed when the app bar is not completely open. This can contain the following values

– Compact

– Minimal

– Hidden

    1 Comment

  1. CG
    October 15, 2015
    Reply

    Hello, how are we supposed to reappear the bar ? Does the system do the trick for us with a gesture ?
    Thanks

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

This blog post will guide you through several effective methods to troubleshoot and resolve the issue of Microsoft Edge not...
Windows 11 offers a range of audio enhancements that can enrich your listening experience. These enhancements include features like virtual...
Windows 11 brings a fresh and visually stunning design to your desktop, and one of the standout features is the...