ensure the flyout is closed before opening a new one

This commit is contained in:
Pilzinsel64
2025-04-08 08:32:28 +02:00
parent b60f8541f2
commit 3292c09a5f
2 changed files with 24 additions and 3 deletions

View File

@@ -101,14 +101,23 @@ partial class RadFlyoutBase
titleToAssing = title;
iconToAssign = icon;
ParentContext = controlToAssociate;
CloseFlyout(false); // Ensure it's closed!
RadFlyoutManager.Show(controlToAssociate, flyoutContentType);
}
protected static void CloseFlyout()
{
if (ParentContext == null)
CloseFlyout(true);
}
protected static void CloseFlyout(bool throwOnError)
{
if (throwOnError && ParentContext is null)
throw new NullReferenceException(nameof(ParentContext));
ParentContext.BeginInvoke(RadFlyoutManager.Close);
if (ParentContext is null)
RadFlyoutManager.Close();
else
ParentContext.BeginInvoke(RadFlyoutManager.Close);
}
}