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

2 posts, 0 answers
  1. Johannes
    Johannes avatar
    66 posts
    Member since:
    Dec 2012

    Posted 23 Jul 2014 Link to this post

    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?

  2. George
    Admin
    George avatar
    1332 posts

    Posted 25 Jul 2014 Link to this post

    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.
     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top