We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

TreeView not visible while using DockingManager.ClientControl

Thread ID:





129514 Mar 23,2017 01:58 AM UTC Mar 29,2017 12:02 PM UTC WPF 7
Tags: TreeViewAdv
Thomas Christof
Asked On March 23, 2017 01:58 AM UTC

I created a TreeView as follow (HierarchicalView.xaml):

        <panels:HierarchicalViewModel />

    <syncfusion:TreeViewAdv ItemsSource="{Binding Root}" Background="Transparent" HorizontalAlignment="Center" VerticalAlignment="Center" BorderThickness="0">
                <HierarchicalDataTemplate ItemsSource="{Binding Children, Mode=TwoWay}">
                        <TextBlock Text="{Binding Name}" Foreground="White" Background="Red" />

The ViewModel does contain a Root. And the root does contain the Children.
But it doesn't display anything, while using the DockingManager.

        <s:DockingManager PersistState="True" x:Name="SyncDockingManager" ContainerMode="TDI">
                <report:HierarchicalView />

But it does work if I dock it normally

            <report:HierarchicalView s:DockingManager.SideInDockedMode="Left" s:DockingManager.DesiredMinWidthInDockedMode="500" />

I didn't change anything, just moved it out of the <s:DockingManager.ClientControl> tag.
Am I missing something, or is this a bug?

Venkateshwaran Ramdoss [Syncfusion]
Replied On March 23, 2017 08:37 PM UTC

Hi Thomas, 
Thank you for contacting Syncfusion Support. 
We have prepared a sample and tried to reproduce the reported issue at our end. But we were unable to reproduce the reported issue. We have prepared sample for your reference and it can be downloaded from the below link. 
Could you please check the sample and provide more details about your query by modifying the sample and providing replication steps to reproduce the issue? It will be helpful us to proceed further. 
Venkateshwaran V.R. 

Thomas Christof
Replied On March 24, 2017 02:46 PM UTC

Thanks for your time and the prepared example.
I modified it so that you can reproduce the error.

In MainWindow.xaml

Comment IN to see nothing:

                <local:CustomTreeControl />

Comment the above lines out and this in:

            <!--<local:CustomTreeControl />-->

And you can see the result.

Attachment: TreeViewAdv_e42380eb.zip

Vijayalakshmi Roopkumar [Syncfusion]
Replied On March 27, 2017 11:29 AM UTC

Hi Thomas,

Thank you for the update.

We have analyzed the sample and found that you have set the DataContext before CustomTreeControl has been intialized. Whenever on setting the Itemsource control of TreeViewAdv in the DockingManager client control, set the DataContext after the CustomTreeControl has been loaded. Please find the modified sample from the following location.  
Code Snippet: 
 //setting the DataContext in the CustomTreeControl loaded event   
private voidCustomTreeControl_Loaded(object sender, RoutedEventArgs e)   
this.DataContext = newHierarchicalViewModel();  

Sample: http://www.syncfusion.com/downloads/support/forum/129514/ze/TreeViewAdv_Modified-1076472576 

Now the TreeView will visible on setting it in DockingManager client control. 
Please let us know if you have any other concerns on this.

Vijayalakshmi V.R.

Thomas Christof
Replied On March 27, 2017 04:50 PM UTC

Thank you for tracing the error down. But shouldn't it be done automatically? Isn't it the job of your control to load the essential bindings? Just wondering, since I never had to do anything code behind. (xaml.cs)

Venkateshwaran Ramdoss [Syncfusion]
Replied On March 28, 2017 03:11 PM UTC

Hi Thomas, 
Thank you for your update. 
DockingManager is a FrameWork control and not a ItemsControl. So, we should set the DataContext for this. We have prepared a sample for this behavior with ContentControl. In this sample, we have used a ContentControl. Please find the sample and video in the below link.  
Please let us know if you have any other concerns on this. 
Venkateshwaran V.R. 

Thomas Christof
Replied On March 28, 2017 04:03 PM UTC

Thanks again for your effort. I already got it working with your first provided example. Please consider this ticket as already solved and don't provide any further examples or videos. My last answer wasn't a programming related problem, just a suggestion.

Because whenever I declear the DataContext within the xaml, I don't have to set anything code behind. So, I am aware that setting the DataContext in the xaml.cs after the control has been loaded, works. However, from my point of view I can't understand why this is still required, since the DataContext is already provided in the .xaml. So I can just assume, that your TreeViewAdv.ClientControl lack some features.

Marimuthu Sivalingam [Syncfusion]
Replied On March 29, 2017 12:02 PM UTC

Hi Thomas,

Thanks for your update.

We have analyzed your query " I am aware that setting the DataContext in the xaml.cs". In our DockingManager we have bound the DockingManager DataContext property to ClientControl source internally. So, CustomTreeControl DataContext will overridden by DockingManager DataContext to CustomTreeControl even we set the DataContext in xaml. While setting DataContext in loaded event, CustomTreeControl DataContext is updated instead of DockingManager DataContext. So only we suggest you to set DataContext in code behind while using Control inside the DockingManager ClientControl.

Marimuthu S.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon