I am trying to use xamWebTree with hierarchical data tree as shown in following article.
http://devjitsu.com/blog/2010/04/23/hierarchicaldatatrees-with-a-custom-datasource/
I am not sure why it does not work it when I use xamWebTree as oppose to standard treeview in silverlight 4. It does show first level node but does not bind child elements. I would be great if there are any solution to it. Thanks
Hi,
Are you using our latest ServiceRelease (available in our product download section at our site)?
It is required to allow Silverlight4 support.
HTH,
Thanks Stoimen for quick reply.
I have applied Service Release but same result. I think I have to mention one thing here, I am using WCF RIA services for data. My table is as follow:
ElementID ElementName ParentID
1 Element1 Null
2 Element2 Null
3 Element3 1
ParentID is related to ElementID and my SL 4 treeview comes fine with child but not xamWebTree. It would be nice if you could download the sample code above and try to replace with xamwebtree. Asking a lot, Thanks
You need to specify HierarchicalItemTemplate property for each nested level of items.
This could be done both in XAML and CS.
Please, check the attached solution for a sample which uses XAML to define the HierarchicalItemTemplate.
Hi
I have been trying to do the same, if possible can you please let me know how you intend to do the hierarchical binding when you have the id, parent id relationship.
Hi Jamir,
The 10.1.2010.1005 is the 10.1 Volume Release version and it has been built with Silverlight3. build 10.1.2010.2022 - the 10.1 Service Release however has been released with Silverlight4 compatibility, so you either need to:
1. Switch your project to Silverligh3 version
2. Update to latest 10.1 Service Release
I download your "TreeExploratory" example and I upgraded it to version 10.1.20101.1005. This did not work, just shows the first level and does not expand the following sublevels.
Could you tell me why it didn't work.
Thanks
Jaimir
Since my hierarchy does not have fixed number of levels, I will use standard treeview for now for the simplicity. But I would love to use xamwebtree if such hierarchy are supported out of box. Thanks for you help. I am closing this thread now.
Hi Stoimen,
I have tried your sample as well. Based on the sample I have my SL treeview which looks like this and it is perfect
<sdk:TreeView x:Name="ElementTree" ItemsSource="{Binding Model}" Grid.Row="1" Grid.RowSpan="11"> <sdk:TreeView.ItemTemplate> <sdk:HierarchicalDataTemplate ItemsSource="{Binding ChildElements}"> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding ElementKey}" Margin="2,0" /> </StackPanel> </sdk:HierarchicalDataTemplate> </sdk:TreeView.ItemTemplate> </sdk:TreeView>
And for Infragistics xamtreeview following
<igTree:XamWebTree x:Name="dataTree" BorderThickness="0,0,0,0" Background="#FFFFFFFF" HorizontalAlignment="Stretch" ItemsSource="{Binding Model}" Grid.Column="1" Grid.ColumnSpan="2" Margin="0,36,73,0" Grid.Row="1"> <igTree:XamWebTree.HierarchicalItemTemplate> <igcontrol:HierarchicalDataTemplate ItemsSource="{Binding ChildElements}"> <DataTemplate> <TextBlock Text="{Binding ElementKey}"/> </DataTemplate> <igcontrol:HierarchicalDataTemplate.HierarchicalItemTemplate> <igcontrol:HierarchicalDataTemplate ItemsSource="{Binding ChildElements}"> <DataTemplate> <TextBlock Text="{Binding ElementKey}"/> </DataTemplate> <igcontrol:HierarchicalDataTemplate.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding ElementKey}"/> </DataTemplate> </igcontrol:HierarchicalDataTemplate.ItemTemplate> </igcontrol:HierarchicalDataTemplate> </igcontrol:HierarchicalDataTemplate.HierarchicalItemTemplate> </igcontrol:HierarchicalDataTemplate> </igTree:XamWebTree.HierarchicalItemTemplate> </igTree:XamWebTree>
I wanted to use mvvm pattern and its pretty straight forward to bind
expand event in xamwebtree thats why I am trying to make it work, but for
some reason its not working. Thank you very much for all your efforts.
One last question, is there any example with binding hierarchical tree using WCF ria service?
My table has ID and parentID column which are related and I am using EDM. In short, exactly same as the sample stated above.
Thanks,