This is a migrated thread and some comments may be shown as answers.

Getting a refence to a floating RadDocumentPane

1 Answer 108 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 26 Jul 2019, 06:35 PM

I have a service that creates/shows new RadDocumentPanes, as well as modal RadWindows. In order to set the owner of a new modal RadWindow I have code that finds the current active window to set it as the owner of the new modal RadWindow. That is easy enough if the active RadDocumentPane is docked,

RadDocumentPane ownerDocpane = MainWindowViewModel.ViewContainer.Items.OfType<RadDocumentPane>().FirstOrDefault(x => x.IsActive);

but if the pane is floating I cannot figure out how to get a reference to it.

I know that it is being hosted in a "ToolWindow", or in our case a (Telerik.Windows.Controls.InternalWindow.ChromelessWindowHelper+WindowHostWindow), but I need a way (at runtime) to find the active ToolWindow so I can populate the Owner property of the new modal RadWindow. 

Any help you can give me would be appreciated!

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 31 Jul 2019, 01:41 PM
Hi Mike,

Thank you for your interest in our RadDocking control for WPF.

What comes up to my mind is to subscribe to the PaneStateChange event of the RadDocking. This event is fired when pane changes its state. You can take a look at the Pane States help article for further information. In the event handler, you can use the event arguments to get the current RadPane. And at last, to see if the pane is floating you can use its IsFloating property. You can create a collection, for example, to preserve the panes which are in a floating state. 
private void Docking_PaneStateChange(object sender, Telerik.Windows.RadRoutedEventArgs e)
{
    var pane = e.OriginalSource as RadPane;
    if(pane.IsFloating)
    {
        // populate a collection
    }
}

Regards,
Dinko
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Docking
Asked by
Mike
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or