In Windows 8.1 how to keep SettingsFlyout visible when focus is set elsewhere?
Asked Answered
P

2

5

In Windows 8.1 when native SettingsFlyout is visible and I click elsewhere, either in my app or in other app, the flyout disappears.

Is there a way to keep it visible until I dismiss is manually? My use case - I want to display "login" SettingsFlyout that won't disappear when user leaves the app and searches for his login name and password.

I've checked MSDN pages for it, but found no simple property for "Sticky" flyout.

Thanks for any hint!

Pascia answered 19/10, 2013 at 16:15 Comment(0)
T
1

There's no way to use the default API to make the SettingsFlyout "sticky" like the AppBar. The best way to achieve your scenario would be to make a custom SettingsFlyout-like Popup; the Callisto library implements one, and you can turn off IsLightDismissEnabled on the Popup to make it "sticky".

Throstle answered 25/10, 2013 at 17:28 Comment(2)
The Callisto control you are pointing to says OBSOLETE (and deprecated). It suggests us to use the SettingsFlyout provided by Microsoft.Bobker
It's deprecated if you just want a SettingsFlyout. If you want to make a custom control that is similar to a SettingsFlyout then it is a good place to start.Watchdog
C
6

There is one way to do it without using the Callisto library with the default controls within the SDK.

public class CustomSettingsFlyout : SettingsFlyout
{
    bool back = false;
    private Popup popup;
    public void ShowWindow()
    {
        ShowIndependent();
        back = false;
        popup = (Parent as Popup);
        popup.IsLightDismissEnabled = false;
        popup.Closed += Popup_Closed;
        this.BackClick += CustomSettingsFlyout_BackClick;
    }

    void CustomSettingsFlyout_BackClick(object sender, BackClickEventArgs e)
    {
        back = true;
    }

    private void Popup_Closed(object sender, object e)
    {
        if (!back) popup.IsOpen = true;
    }



}

Now call the ShowWindow method is place of ShowIndependent on the new control.

CustomSettingsFlyout flyout = new CustomSettingsFlyout();
flyout.Content = new Grid();
flyout.ShowWindow();
Conjugal answered 19/11, 2013 at 4:30 Comment(3)
This worked for me, except the flyout closes briefly then reopens the first time you click outside it. But it is also very helpful when debugging flyouts since they close when you enter a breakpoint.Fivefold
@Conjugal - Can we achieve the same thing by using pure XAML without code-behind?Bobker
@Conjugal - When the app is moved between 2 screens of different resolution, these settings flyout UI gets messed up.Bobker
T
1

There's no way to use the default API to make the SettingsFlyout "sticky" like the AppBar. The best way to achieve your scenario would be to make a custom SettingsFlyout-like Popup; the Callisto library implements one, and you can turn off IsLightDismissEnabled on the Popup to make it "sticky".

Throstle answered 25/10, 2013 at 17:28 Comment(2)
The Callisto control you are pointing to says OBSOLETE (and deprecated). It suggests us to use the SettingsFlyout provided by Microsoft.Bobker
It's deprecated if you just want a SettingsFlyout. If you want to make a custom control that is similar to a SettingsFlyout then it is a good place to start.Watchdog

© 2022 - 2024 — McMap. All rights reserved.