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

In this post, you will learn about sync provider notifications in Windows 11 and how to disable or enable it...
In this tutorial, let’s learn how to enable or disable the startup sound in Windows 11. By default, when Windows...
The CameraCaptureTask allows the Windows Phone 7 App to launch the Camera Application . This will be useful when the...