locked
CommandBar within AppBar - Open/Close Issue

    Question

  • I've been using a CommandBar within an Appbar in a Windows 8.1 App.

    On opening the Appbar with IsOpen=true; the AppBar appears, but it is empty and only displays the CommandBar on the second activation.

    On closing the AppBar with IsOpen=false, then reopening the AppBar, the OnOpen method doesn't get run and only gets executed on subsequent activations.

    It looks like the Opening of the CommandBar is not being triggered by the Opening of the AppBar and the Closing of the AppBar is not triggering the OnOpen event the next time the AppBar is opened, because the CommandBar has not been closed during the previous AppBar closure.

    I got around these problems by tying anonymous methods to the Opened and Closed events of the AppBar to explicitly change the value of IsOpen for the CommandBar.

    Is this issue a bug with the AppBar/CommandBar?

    If so where do I report it?

    • Moved by Marvin_Guo Tuesday, January 27, 2015 8:22 AM Windows Store App Releated
    Monday, January 26, 2015 2:11 PM

Answers

  • Hi,

    I test your project and I think I can explain why. CommandBar like AppBar which are hidden by default, and are shown or dismissed when the user right-clicks, presses Windows+Z, or swipes from the top or bottom edge of the screen. When you right-click at the first time, the AppBar will shown but the commandBar will not, because the commandBar contain in the AppBar, if the AppBar triggerd by the right-click, the children in it will not. So you should right-click again to open the CommandBar. Also, if you dimiss the AppBar, beacuse CommandBar as a content of AppBar, if the AppBar closed, the content and children in it will also disposed. So when the AppBar closed, the CommandBar will be closed(if the CommandBar already open).

    Why do you make the CommandBar contain in AppBar? As far as I know, you can choose one of them to create UI. More information in the link below:

    https://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh781232.aspx

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    Wednesday, February 4, 2015 1:52 AM

All replies

  • Hello,

    Since this issue is related with store app, I move it to the store app forum there are store app exeprts who will help you.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, January 27, 2015 8:16 AM
  • Hi,

    I cannot reproduce the problem. Would you mind sharing a project which can reproduce the problem into OneDrive and share a link here?

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    Thursday, January 29, 2015 9:03 AM
  • Here's a link to a project I created that demonstrates the issue...

    http://1drv.ms/1JZ45KS

    I created Custom Classes for both the AppBar and CommandBar so that they could update TextBlocks on the ItemsPage whenever either was opened or closed.

    I included the code I used to fix the issue which is commented out.

    If you activate the AppBar using the right mouse, you have to press it twice to see the CommandBar. If you close the AppBar using left mouse elsewhere on the screen the Closed event on the CommandBar gets skipped.


    Sunday, February 1, 2015 6:53 AM
  • Hi,

    I test your project and I think I can explain why. CommandBar like AppBar which are hidden by default, and are shown or dismissed when the user right-clicks, presses Windows+Z, or swipes from the top or bottom edge of the screen. When you right-click at the first time, the AppBar will shown but the commandBar will not, because the commandBar contain in the AppBar, if the AppBar triggerd by the right-click, the children in it will not. So you should right-click again to open the CommandBar. Also, if you dimiss the AppBar, beacuse CommandBar as a content of AppBar, if the AppBar closed, the content and children in it will also disposed. So when the AppBar closed, the CommandBar will be closed(if the CommandBar already open).

    Why do you make the CommandBar contain in AppBar? As far as I know, you can choose one of them to create UI. More information in the link below:

    https://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh781232.aspx

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    Wednesday, February 4, 2015 1:52 AM