BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Let's take two different classes, one for parent, one for children :
public class ParentElement
{
public string ParentName { get; set; }
public IEnumerable<ChildElement> Children { get; set; }
}
public class ChildElement
{
public string ChildName { get; set; }
}
And some ViewModel :
public class SomeViewModel
{
...
public IEnumerable<ParentElement> Parents { get; set; }
}
I have no problem using TreeView to apply different templates for parents and children :
<sdk:TreeView x:Name="TvControl" ItemsSource="{Binding Parents}">
<sdk:TreeView.ItemTemplate>
<template:HierarchicalDataTemplate ItemsSource="{Binding Children}">
<TextBlock Text="{Binding ParentName}"/>
<template:HierarchicalDataTemplate.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding ChildName}"/>
</DataTemplate>
</template:HierarchicalDataTemplate.ItemTemplate>
</template:HierarchicalDataTemplate>
</sdk:TreeView.ItemTemplate>
</sdk:TreeView>
However, HierarchicalDataTemplate seems to have a completely different behavior when used by TreeViewAdv and I just couldn't find a way to apply two different templates for Parents and Children elements.
When using the code above with TreeViewAdv instead of TreeView never brings the inner template (the one with the ChildName property) to the screen.
Is there any way to do this to reproduce with TreeViewAdv the behavior I get with TreeView ?
Hi Xavier,
Thanks for using Syncfusion products.
We have created a sample based on your
requirement “two different templates for parent and child elements in
TreeViewAdv”. Please find the attached sample.
Please let us know if you have any queries.
Regards,
Karthik
Hi,
Thank you for your answer. Unfortunately, I get the same behavior I had with my tests, meaning the child template is never used and the ChildName property never displayed.
I forgot to tell, maybe is it relevant, but my project is targeting Silverlight 5.
Hi Xavier,
Thanks for your update.
We have checked the sample with Silverlight 5 and we are
unable to reproduce the problem. We have attached a sample in which we tried in
Silverlight 5. Could you please modify the sample to reproduce the problem and
provide the information like currently which syncfusion version you are using. This would be help for us to analyze the problem.
Please let us know if you have any other queries.
Regards,
Karthik
Hi,
the problem is there when I execute your code as-is. I don't have to modify anything. I just open your solution, compile and execute it, and the ChildName property is never displayed.
The Essential Studio release is 11.1.0.21. The Syncfusion..Tools.Silverlight dll is 11.104.0.21.
It's working. Awesome job, thanks !