Template 10: Hamburger Menu can not auto open after changing VisualStateDisplayMode

234 views Asked by At

I'm a little puzzled on Hamburger Menu 's DisplayMode. I want the hamburger menu can be completely closed in Normal and wide visual states. I try to set VisualStateWideDisplayMode to Inline,it's Indeed inline but the pane cannot open automaticaly.when i open the pane and click navigate to another page,the pane closed.but I want it can be always open. I try to set IsOpen to True,but i's no effect.

If i should write some triggers or use another way? Thanks for help.

code like this:

     <Controls:HamburgerMenu x:Name="MyHamburgerMenu" 
                             VisualStateNormalDisplayMode="Overlay"
                             VisualStateWideDisplayMode="Inline"
                             IsOpen="True"/>
2

There are 2 answers

1
Xie Steven On

I have checked the source code of Template10. It seems that it's by design. Even if you have set the DisplayMode and IsOpen value on xaml page. But in HamburgerMenu's code-behind, it always would change DisplayMode and IsOpen's value according to the VisualStateGroup.CurrentState's value. You could see this behavior in "UpdateVisualStates()" method in Template10 source code.

So I think if you want change this default behavior, you need to rebuild a custom version yourself. Or you could use SplitView to make your custom HamburgerMenu control like James Quick descirbes here: Windows 10 SplitView – Build Your First Hamburger Menu

0
Jerry Nixon On

I believe you have discovered a bug. I have reported it here https://github.com/Windows-XAML/Template10/issues/1381

Thank you for using Template 10