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’ll learn about the Win32 Error “0x000019E5 – ERROR_COULD_NOT_RESIZE_LOG” that you get when debugging system erors in...
In this post, you’ll learn about the error “CO_E_DBERROR 0x8004E02B” that is returned when working with COM based APIs or...
In this post, you’ll learn about the Win32 Error “0x000019D0 – ERROR_LOG_BLOCK_VERSION” that you get when debugging system erors in...