1

I would like to create a commandbar (former appbar) that is not getting closed when the user presses one of the primary command buttons. When i got it right, the "issticky"-property should make this behavior possible.

My XAML Code:

<Page.BottomAppBar>
    <CommandBar x:Name="bottomCommandBar" IsSticky="True" ClosedDisplayMode="Minimal">
        <CommandBar.PrimaryCommands>
            <AppBarButton x:Name="button1" Label="Button1" Tapped="Button1_Tapped">
                <AppBarButton.Icon>
                    <PathIcon Data=""/>
                </AppBarButton.Icon>
            </AppBarButton>
            <AppBarButton x:Name="button2" Label="Button2" Tapped="Button2_Tapped">
                <AppBarButton.Icon>
                    <PathIcon Data=""/>
                </AppBarButton.Icon>
            </AppBarButton>
        </CommandBar.PrimaryCommands>
    </CommandBar>
</Page.BottomAppBar>

IsSticky = true doesn't work, i also tested to set it in the button tapped event handler.

What is the regular way of getting this behavior? Or does anyone know a 'workaround'?
I would be grateful for any suggestions!
Best,

formatC
  • 83
  • 6

2 Answers2

0

Change the ClosedDisplayMode to Compact or remove it from the CommandBar definition (it's the default).

<CommandBar x:Name="bottomCommandBar" ClosedDisplayMode="Compact">

or

<CommandBar x:Name="bottomCommandBar">
Igor Ralic
  • 14,975
  • 4
  • 43
  • 51
  • Thanks, but i don't want the primary commands to be displayed all the time :-( – formatC Jul 14 '14 at 20:00
  • @formatC how about somehow manipulating ClosedDisplayMode once it's displayed or when the app bar button is tapped, and then releasing it once the user taps somewhere else? – Igor Ralic Jul 14 '14 at 21:24
  • yeah, that would work when using only primarycommands. I simplified the code snippet posted above - i would like to use secondary commands too. I don't get it: do i misunterstand the function of the issticky-property, or is this a bug in wp8.1? – formatC Jul 15 '14 at 14:33
-1

Try this in your page load

((AppBar)bottomCommandBar).IsSticky = true;
Muhammad Saifullah
  • 4,292
  • 1
  • 29
  • 59