Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!

like image 386
Martin Suchan Avatar asked Oct 19 '13 16:10

Martin Suchan


1 Answers

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();
like image 194
Shubhan Avatar answered Nov 14 '22 22:11

Shubhan