I want to hide hamburger menu button automatically in order to display menu from the top to the bottom of the page. For this purpose I tried to bind HamburgerButtonVisibility to IsPaneOpen property:
<controls:HamburgerMenu x:Name="Menu" VisualStateNarrowMinWidth="0" HamburgerBackground="White" HamburgerForeground="Black"
NavAreaBackground="{StaticResource MenuBackground}"
HamburgerButtonVisibility="{x:Bind Menu.IsOpen, Mode=OneWay, Converter={StaticResource ReverseBooleanToVisibilityConverter}}" />
But with this solution there is one issue: when I open the menu and tap outside of menu, menu is closed but hamburger button disappears.
Are there any other solution for this?
Also I didn't find out how to set NavigationService into HamburgerMenu if menu belongs for a page (not shell). I've tried to set it using page ViewModel, but I get NRE in this case:
<Page
x:Class="App.LoginPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:App.ViewModels"
mc:Ignorable="d">
<Page.DataContext>
<vm:LoginViewModel />
</Page.DataContext>
<controls:HamburgerMenu x:Name="Menu" />
</Page>
sealed partial class LoginPage : Page
{
public LoginPage ()
{
this.InitializeComponent ();
Menu.NavigationService = ViewModel.NavigationService; //NRE here
}
public LoginViewModel ViewModel => DataContext as LoginViewModel;
}
Stack trace:
at Template10.Controls.HamburgerMenu.set_NavigationService(INavigationService value)
at App.LoginPage..ctor()
at App.App_XamlTypeInfo.XamlTypeInfoProvider.Activate_46_LoginPage()
at App.App_XamlTypeInfo.XamlUserType.ActivateInstance()