Getting a refence to a floating RadDocumentPane

2 posts, 0 answers
  1. Mike
    Mike avatar
    1 posts
    Member since:
    Jun 2019

    Posted 26 Jul 2019 Link to this post

    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!

  2. Dinko
    Admin
    Dinko avatar
    984 posts

    Posted 31 Jul 2019 Link to this post

    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.
Back to Top