RadDock ActiveWindow issue?

1 Answer 64 Views
Dock
Henrique
Top achievements
Rank 1
Henrique asked on 07 Mar 2023, 06:42 PM

In the image below I have five DocumentWindow (state names) and a ToolWindow (Properties). Following this steps, the ActiveWindowChanged event is called twice from different windows:

  1. make Colorado (tabbed window) the active window
  2. make California (Floating window) the active window
  3. make Properties (ToolWindow) the active window. At this point, the ActiveWindowChanged event is called twice. The first one changes the ActiveWindow from California to Colorado. And the second call changes the ActiveWindow from Colorado to Propeties.

This is making the application shows the Colorado properties instead of the California properties.

Is this the expected behavior? Is there a way to fix it?

I am using UI.for.WinForms.AllControls.Net40 v2022.3.921

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 10 Mar 2023, 02:45 PM

Hello, Henrique,

Thank you for the provided details.

I was able to observe the described behavior. It comes from the fact that when you select a tab from a floating window, the DocumentTabStrip in the docked state still holds the last selected tab. So when you focus the window again, first the last selected tab will be used as an ActiveWindow, then the mouse hit will change the active window if it is different from the last one selected in the tab strip. You could workaround this by setting the DocumentTabStrip SelectedIndex property to -1 if the new active window is floating. May I ask you to check the attached project and let me know if this approach will work for you?

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Henrique
Top achievements
Rank 1
commented on 10 Mar 2023, 05:44 PM

Hi Dinko,

Thank you for your response.

Unfortunately, the solution you suggested didn't work. If I float Florida window and, right after, click in Properties window the active window moves to Colorado before move to Properties.

In addition, when I click back in the tabbed area (Colorado window) it activates Hawaii window.

Regards,

Henrique

Dinko | Tech Support Engineer
Telerik team
commented on 14 Mar 2023, 01:42 PM

When the DocumentTabStrip is clicked it will set the ActiveWindow to the last selected tab. In this case, you can modify the ActiveWindowChanged event handler and check the newly activated window if it is part of the DocumentTabStrip. If it is not, clear the selection. You can also set similar logic in the DockStateChanged event. Give it a try and let me know how it goes.

private void RadDock1_DockStateChanged(object sender, Telerik.WinControls.UI.Docking.DockWindowEventArgs e)
{
    if(e.DockWindow.DockState == Telerik.WinControls.UI.Docking.DockState.Floating)
    {
        this.documentTabStrip1.SelectedIndex = -1;
    }
}

private void radDock1_ActiveWindowChanged(object sender, Telerik.WinControls.UI.Docking.DockWindowEventArgs e)
{
    if (e.DockWindow != null)
    {
        if(!this.documentTabStrip1.Controls.Contains(e.DockWindow))
        {
            this.documentTabStrip1.SelectedIndex = -1;
        }
        Console.WriteLine(e.DockWindow.Text);
    }
}

Tags
Dock
Asked by
Henrique
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or