Drag and drop and dock maximized

3 posts, 1 answers
  1. Jacob
    Jacob  avatar
    49 posts
    Member since:
    Apr 2016

    Posted 26 May Link to this post

    Hello telerik,

     

    I am about to finish a custom implementation of a feature which consists of an element from a treeview being dragged to a Docking pane.

    The attached screen shot shows how it happens.

     

    The only thing missing so far is I need to find a way to dock it maximized or expanded, as of now the usercontrol comes taking only part of the space available as default.

     

    is there an easy way to achieve the desired behavior problematically?

    Here is my code:

    private void RadDocking_Drop(object sender, DragEventArgs e)
        var data = e.Data.GetData("TreeViewDragDropOptions");
        var item = ((TreeViewDragDropOptions)data).DraggedItems.First();
        var splitter = ((RadDocking)sender).Items[0];
        RadPaneGroup group = (RadPaneGroup)((RadSplitContainer)splitter).Items[0];
        var newPane = new RadPane();
        switch (((RadTreeViewItem)item).Name)
        {
            case "RadPdfViewer":
                newPane.Content = new UserControl1();
                newPane.Header = "uc1";
                break;
     
            case "RadChartview":
                newPane.Content = new UserControl2();
                newPane.Header = "uc2";
                break;
     
            case "RadDataFilter":
                newPane.Content = new UserControl3();
                newPane.Header = "uc3";
                break;
     
        }
        if (newPane.Content != null)
            group.AddItem(newPane, Telerik.Windows.Controls.Docking.DockPosition.Center);
    }

     

     

    Thank you

  2. Answer
    Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    603 posts

    Posted 30 May Link to this post

    Hello Jacob,

    Based on your description, it seems that you need to work with the DocumentHost of your RadDocking.

    Could you please try wrapping your RadSplitContainer inside of the DocumentHost container and let me know if that provides the desired result?

    If that is not the case, please provide more details on your exact requirements as well as the layout you have set up right now so that I can further guide you in finding a solution.

    I'm looking forward to your reply.

    Regards,
    Dilyan Traykov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. Jacob
    Jacob  avatar
    49 posts
    Member since:
    Apr 2016

    Posted 31 May in reply to Dilyan Traykov Link to this post

    Hello Dilyan,

    It is my pleasure to inform you your solution works perfect on my side.

    I just needed to do some adjusts in the function i have sent, so whoever comes across this same issue, here is what it takes to reach the RadGroupPane

    var data = e.Data.GetData("TreeViewDragDropOptions");
                var item = ((TreeViewDragDropOptions)data).DraggedItems.First();
                var dock = (RadDocking)sender;
                var group = (RadPaneGroup)((System.Windows.Controls.ItemsControl)dock.DocumentHost).Items[0];

     

    and here is how the docking should look like

    <telerik:RadDocking Grid.Row="0" Grid.Column="0" Drop="RadDocking_Drop" AllowDrop="True">
        <telerik:RadDocking.DocumentHost>
            <telerik:RadSplitContainer >
                <telerik:RadPaneGroup>
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
        </telerik:RadDocking.DocumentHost>
    </telerik:RadDocking>

     

    Thank you again!

Back to Top