Is there an alternative to Windows 8.1 SettingsFlyout in Windows 10 UWP?

I am currently developing a UWP application for Windows 10. Before I upgraded to Windows 10, I used the SettingsFlyout class in Windows 8.1. Now I am blushing in stackoverflow that this class is not supported by Windows 10.

So, is there a good alternative for a popup in Windows 10 UWP that has the same or similar handling?

+4
source share
1 answer

If you want to replace "Settings", there are several possible ways 1. Add the SettingsPage.xaml page with settings and navigation from the AppBar:

<Page.TopAppBar>
    <CommandBar IsOpen="False" ClosedDisplayMode="Minimal">
        <CommandBar.PrimaryCommands>
<AppBarButton x:Name="btnSettings" Label="Settings" Click="btnSettings_Click" Icon="Setting"  >
            </AppBarButton>
        </CommandBar.PrimaryCommands>
    </CommandBar>
</Page.TopAppBar>

And implement the click event:

 private void btnSettings_Click(object sender, RoutedEventArgs e)
    {
        this.Frame.Navigate(typeof(SettingsPage));
    }

"".
OnLaunched :

rootFrame.Navigated += OnNavigated;
SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;

:

   private void OnNavigated(object sender, NavigationEventArgs e)
    {
 SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
        ((Frame)sender).CanGoBack ? AppViewBackButtonVisibility.Visible : AppViewBackButtonVisibility.Collapsed;
    }

    private void OnBackRequested(object sender, BackRequestedEventArgs e)
    {
        Frame rootFrame = Window.Current.Content as Frame;

        if (rootFrame.CanGoBack)
        {
            e.Handled = true;
            rootFrame.GoBack();
        }
    }

2. xaml , SplitView Hamburger

Windows 10 SplitView -

3. ContentDialog

4. ,

<Button Content="Settings">
<Button.Flyout>
<MenuFlyout>
<ToggleMenuFlyoutItem Text="Toggle Setting" />
<MenuFlyoutSeparator />
<MenuFlyoutItem Text="Setting 1" />
<MenuFlyoutItem Text="Setting 2" />
<MenuFlyoutItem Text="Setting 3" />
</MenuFlyout>
</Button.Flyout>
</Button>
+1

Source: https://habr.com/ru/post/1626858/


All Articles