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

How to set DataTemplates for bound RadPaneViewModels? (PanesSource, MVVM)

1 Answer 104 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Johannes
Top achievements
Rank 1
Johannes asked on 23 Jul 2014, 09:38 AM
I worked through RadDocking documentation and also a lot of your (SDK) examples but I still did not find out how to set the DataTemplate of a RadPane.

In my project I use the same approach as in your SDK example "VisualStudioDocking_WPF" so RadDocking.PanesSourceis bound to an ObservableCollection<PaneViewModel>. With that I can dynamically add RadPanes on my RadDocking.DocumentHost in an MVVM friendly way. That's nice but sadly the example ends here - each RadPane is an empty Control just showing the TypeName of the ViewModel.

In my CustomDockingPanesFactory.CreatePaneForItem I set the following properties:
pane.DataContext = paneViewModel;
pane.Header = paneViewModel.UserControlViewModel.Header;
pane.Content = paneViewModel.UserControlViewModel;

What I need is an example of how to set the DataTemplates for my RadPanes. Is there a clean way to set the DataTemplates and the DataTemplateSelector on XAML?

1 Answer, 1 is accepted

Sort by
0
George
Telerik team
answered on 25 Jul 2014, 12:59 PM
Hello Johannes,

RadDocking control doesn't support DataTemplates and DateTemplateSelectors at this stage. I would suggest using the CreatePaneForItem​ method and set via code any property which is required. The nature of this control limitation is by design - the Docking is a layout control and it doesn't work like the ItemsControls.

Regards,
George
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
Docking
Asked by
Johannes
Top achievements
Rank 1
Answers by
George
Telerik team
Share this question
or