How to cancel ONE of multiple Tabbed Floating Control Closes

Using DockingManager:
I have 2 controls floating, tabbed.

When the user clicks the Close button, I don't want BOTH to close, just the current one.

I know I need to use the DockVisibilityChanging, but don't really know how to accomplish this. If I cancel, it cancels all of them.

I need the first non-selected control in the tab group to become the active control, and the one that was active to go away.


1 Reply

GR Golda Rebecal Syncfusion Team October 26, 2007 10:54 AM UTC

Hi ERobishaw,

Sorry for the delay in responding.

You can achieve your requirement using the following code:

[C#]
void dockingManager1_DockVisibilityChanging(object sender, DockVisibilityChangingEventArgs arg)
{
bool flag = false;
DockHost dhost2 = arg.Control.Parent as DockHost;
DockHostController dhc = dhost2.InternalController as DockHostController;
if ((dhc.ParentController != null) && (dhc.ParentController is DockTabController))
{
DockTabController dtc = dhc.ParentController as DockTabController;
DockTabControl tabcontrol = dtc.TabControl as DockTabControl;
TabPageAdv tab1 = tabcontrol.SelectedTab;
tab1.Hide();
foreach (TabPageAdv tab in tabcontrol.TabPages)
{
if (tab.TabVisible == true)
{
flag = true;
break;
}
}
}
if (flag)
arg.Cancel = true;
}

Please refer to the attached sample that illustrates the same:
http://websamples.syncfusion.com/samples/Tools.Windows/F69219/main.htm

Kindly let me know if this helps you.

We appreciate your interest in Syncfusion products.

Best regards,
Golda

Loader.
Up arrow icon