Home > C#, WinRT > Using Windows 8.1 SettingsFlyout control as a normal Flyout

Using Windows 8.1 SettingsFlyout control as a normal Flyout

07/10/2013

Despite its name, the new SettingsFlyout control that comes with Windows 8.1 can be used as a normal flyout, like the one that is used, for example, by the offial Twitter app for Windows Store:

Twitter Flyout

Twitter Flyout for new message

In other word, its usage isn’t limited to the Settings Pane. We can add a SettingsFlyout to our project and then show it whenever we want using its Show method. However, in this way, when we press the Back button on the Flyout header, we will return to the Settings pane, obtaining an unwanted behavior.

The solution is really simple: instead of Show, we just need to use the ShowIndipendent method:

private void Button_Click(object sender, RoutedEventArgs e)
{
    var flyout = new MyFlyout { Width = 646 };
    
    // Opens the Settings flyout, and returns the user to the app 
    // after the flyout is dismissed.
    flyout.ShowIndependent();
}

Now, when we press the Back button, the Flyout will be dismissed and no other Pane will appear.

Categories: C#, WinRT
%d bloggers like this: