locked
Showing the app bar conditionally in windows store apps RRS feed

  • Question

  • Hi,

    Usually in windows store apps, if I have a screen with app bar the default behavior is that the app bar becomes visible when I right click on the screen.

    I want to control this. I want to decide based on some conditions when it shall be visible on right click and when not.

    I have a screen with app bar and a pop up. I want the app bar not to become visible when pop is open and I do right click. But it should be come visible when the pop up is closed and when I right click.

    Can some body tell me how to perform this. Seems like I need set some property of app bar.

    Tuesday, October 1, 2013 9:13 AM

Answers

  • Another alternative is make the Appbar Collapsed(Hide) when you open the popup and when you close it, make the Appbar Visible.

    Soemthing like

    this.TopAppBar.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
    when you open the popup and set it to Visible in the close event of the popup.

    Nazia

    Friday, October 4, 2013 12:47 PM
  • Hi Naveen,

    Welcome to MSDN forum!

    AppBar.IsOpen just tells you the appbar's state. You couldn't control appbar is display or not by using IsOpen property.

    You just need to set appbar.width=0 and appbar.height=0 while you need to show your pop up. Then the appbar is hidden.

    And when you want to display your appbar, just reset its width and height.

    Regards!


    <font color="0099FF">&lt;THE CONTENT IS PROVIDED &quot;AS IS&quot; WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED&gt;</font><br/> Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Wednesday, October 2, 2013 2:12 AM
    Moderator

All replies

  • Hi ,

    Have you tried this.

    I have a bottom bar in my XAML but it's the same thing .

    <Page.BottomAppBar>
            <AppBar x:Name="bottomAppBar" Padding="10,0,10,0" IsOpen="True" >
                <Grid>
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                        <Button Style="{StaticResource SettingsAppBarButtonStyle}" Click="Button_Click_3"/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                        <Button Style="{StaticResource HelpAppBarButtonStyle}" Click="Button_Click_2" />
                    </StackPanel>
                </Grid>
            </AppBar>
        </Page.BottomAppBar>

    And in your code you can control it like the below;

       this.bottomAppBar.IsOpen = true;  or    this.bottomAppBar.IsOpen = false;

    When the XAML loads I'm displaying the Appbar and then I'm using the above code according to my needs.


    Tuesday, October 1, 2013 9:26 AM
  • Hi Naveen,

    Welcome to MSDN forum!

    AppBar.IsOpen just tells you the appbar's state. You couldn't control appbar is display or not by using IsOpen property.

    You just need to set appbar.width=0 and appbar.height=0 while you need to show your pop up. Then the appbar is hidden.

    And when you want to display your appbar, just reset its width and height.

    Regards!


    <font color="0099FF">&lt;THE CONTENT IS PROVIDED &quot;AS IS&quot; WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED&gt;</font><br/> Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Wednesday, October 2, 2013 2:12 AM
    Moderator
  • Hi  Chen

    Nice idea with the width and height although I disagree that the isopen just tells you the status. You can set it as well if you like.

    It works in my app like that . Place two buttons in a XAMl . The one will set the Isopen = true and the other to false . In windows 8 app works. I don't know in 8.1 if they changed the behavior.

    thank you

    Thursday, October 3, 2013 5:42 AM
  • Hi zakkar,

    Welcome here!

    Yes, you are right. Your post is so helpful!

    But OP asked whether he could control the AppBar while the right mouse button was clicked. And even if the AppBar.IsOpen is set as false, the AppBar will still display when OP right click on the mouse.

    So this method couldn't resolve the OP's issue. 

    Regards! 


    <font color="0099FF">&lt;THE CONTENT IS PROVIDED &quot;AS IS&quot; WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED&gt;</font><br/> Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Thursday, October 3, 2013 7:53 AM
    Moderator
  • OK Chen.

    Didn't notice the right click he was referring to.

    Thursday, October 3, 2013 3:24 PM
  • Another alternative is make the Appbar Collapsed(Hide) when you open the popup and when you close it, make the Appbar Visible.

    Soemthing like

    this.TopAppBar.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
    when you open the popup and set it to Visible in the close event of the popup.

    Nazia

    Friday, October 4, 2013 12:47 PM