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

Drag and drop and dock maximized

2 Answers 164 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Jacob
Top achievements
Rank 1
Jacob asked on 26 May 2017, 09:46 AM

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 Answers, 1 is accepted

Sort by
0
Accepted
Dilyan Traykov
Telerik team
answered on 30 May 2017, 12:09 PM
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 you to write beautiful native mobile apps using a single shared C# codebase.
0
Jacob
Top achievements
Rank 1
answered on 31 May 2017, 06:35 AM

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!

Tags
Docking
Asked by
Jacob
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Jacob
Top achievements
Rank 1
Share this question
or