Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect if Shell Flyout is open

Is there any way to handle opening Flyout? I'm trying to add custom behavior during opening or after opening Flyout.

I can;t find any type of propety like Shell.OnFlyoutOpening="flyout_opening"

like image 735
Wiktor Kęska Avatar asked Oct 21 '25 14:10

Wiktor Kęska


1 Answers

Since there is no and won't be events such OnFlyoutOpened OnFlyoutClosed, you can listen to your Shell PropertyChanged event, if the property is FlyoutIsPresented then execute your code:

public AppShell()
{
    InitializeComponent();
    PropertyChanged += Shell_PropertyChanged;
}

private void Shell_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
    if (e.PropertyName.Equals("FlyoutIsPresented"))
        if (FlyoutIsPresented)
            OnFlyoutOpened();
        else
            OnFlyoutClosed();
}

Depending on your requirement you will define OnFlyoutOpened() and OnFlyoutClosed() methods.

Thanks to @PureWeen guidance in discussion.

like image 195
Cfun Avatar answered Oct 23 '25 08:10

Cfun



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!