I found that the official NavigationView are introduced in newer versions of Visual Studio and can help easily achieve the Hamburger layout, and by setting the property IsSettingsVisible to True, there will autometically be a settings button at the bottom.
My question is pretty simple: How can I handle the click event of this settings button? I cannot find any corresponding properties.
<NavigationView PaneDisplayMode="LeftCompact" IsSettingsVisible="True">
<!--I'm expecting some codes like below-->
<NavigationView.SettingsButton Click="SettingsButton_Click"/>
</NavigationView>
Register a new method to the ItemInvoked event and check if it's the Settings button which got invoked by doing so:
C#:
private async void NavigationView_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args) {
if (args.IsSettingsInvoked) {
// Code here
}
}
XAML:
<NavigationView IsSettingsVisible="True" ItemInvoked="NavigationView_ItemInvoked">
<!-- Your XAML -->
</NavigationView>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With