Unplanned
Last Updated: 01 May 2024 09:57 by ADMIN
Bert
Created on: 01 May 2024 09:52
Category: Dock
Type: Bug Report
1
RadDock: Closing non-active MDI child will change the currently active child
In this case, we have 5 MDI children and the last one is active. Closing the first one from the tab close button will activate the second child. Closing a non-active child should not change the active window in MDI scenario.
1 comment
ADMIN
Dinko | Tech Support Engineer
Posted on: 01 May 2024 09:57

Hi Bert,

Thank you for reporting this. As a workaround, the following code can be used:

this.radDock1.DockWindowClosing += RadDock1_DockWindowClosing;
this.radDock1.ActiveWindowChanging += radDock1_ActiveWindowChanging;

bool shouldCancel = false;
object lastActiveWindow = null;
private void RadDock1_DockWindowClosing(object sender, DockWindowCancelEventArgs e)
{
    if (this.radDock1.ActiveWindow != e.NewWindow)
    {
        shouldCancel = true;
        lastActiveWindow = this.radDock1.ActiveWindow;
    }
}

private void radDock1_ActiveWindowChanging(object sender, DockWindowCancelEventArgs e)
{
    if (shouldCancel)
    {
        if (lastActiveWindow != null)
        {
            this.BeginInvoke((Action)(() =>
            {

                shouldCancel = false;
                this.radDock1.ActivateMdiChild((lastActiveWindow as HostWindow).Content as Form);
                lastActiveWindow = null;
            }));
        }
    }
}

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.