ensure the flyout is closed before opening a new one
This commit is contained in:
@@ -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));
|
||||
|
||||
if (ParentContext is null)
|
||||
RadFlyoutManager.Close();
|
||||
else
|
||||
ParentContext.BeginInvoke(RadFlyoutManager.Close);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Telerik.WinControls;
|
||||
using Telerik.WinControls.UI;
|
||||
|
||||
@@ -27,6 +26,8 @@ public partial class RadFlyoutBase : UserControl
|
||||
[DefaultValue(true)]
|
||||
public bool RegisterDialogCancel { get; set; } = true;
|
||||
|
||||
public new Size PreferredSize { get; set; } = Size.Empty;
|
||||
|
||||
[DefaultValue(true)]
|
||||
public virtual bool ActionPanelVisible
|
||||
{
|
||||
@@ -224,9 +225,20 @@ public partial class RadFlyoutBase : UserControl
|
||||
frm.AutoSize = true;
|
||||
frm.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
}
|
||||
|
||||
frm.Shown += Form_Shown;
|
||||
}
|
||||
}
|
||||
|
||||
private void Form_Shown(object? sender, EventArgs e)
|
||||
{
|
||||
if (FindForm() is not Form frm)
|
||||
return;
|
||||
|
||||
if (!AutoSize)
|
||||
frm.ClientSize = PreferredSize;
|
||||
}
|
||||
|
||||
protected void Close(DialogResult result)
|
||||
{
|
||||
Result = result;
|
||||
|
||||
Reference in New Issue
Block a user