Hi,
based on my senario:
the code here is working fine with microsft silverlight TreeView like this.
<UserControl.Resources>
<test:HierarchicalDataTemplate x:Name="template1" ItemsSource="{Binding Friends}"> <StackPanel> <TextBlock Text="{Binding Path=Name}" /> </StackPanel> </test:HierarchicalDataTemplate>
</UserControl.Resources>
<StackPanel x:Name="LayoutRoot"> <TextBlock Text="{Binding Name}" FontSize="32" /> <controls:TreeView ItemsSource="{Binding Friends}" ItemTemplate="{StaticResource template1}"> </controls:TreeView> </StackPanel>
But, My Question is if i use XamWebTree and binding the tree just like above, it is not working.
can any one help me how to approach this using XamWebTree
Could you provide the namespace to which the "test" alias points?
XamWebTree uses HierarchicalDataTemplate class which is in Infragistics assemblies and namespace, so that might be the problem, e.g.:
xmlns
HTH,
hi,
I have used Infragistics assembly.here is my code, according to my senario.
if u find any solution let me please let me know.
here is my example: (for silverlight treeview it is working fine n-tier hierarchy but for Infragestics silverlight treeview(XamWebTree) i am not getting how to get n-level hierarchy for XamWebTree.
<
UserControl xmlns:igTree="clr-namespace:Infragistics.Silverlight.Controls;assembly=Infragistics.Silverlight.XamWebTree.v9.2" xmlns:controls
="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
x:Class
="RecursiveBinding.MainPage"
="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x
="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:test
="clr-namespace:System.Windows;assembly=System.Windows.Controls"
xmlns:ig
="clr-namespace:Infragistics.Silverlight.Controls;assembly=Infragistics.Silverlight.v9.2"
xmlns:d
="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc
="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable
="d"
d:DesignWidth
="640"
d:DesignHeight
="480">
<UserControl.Resources
>
<test:HierarchicalDataTemplate x:Name
="template12"
ItemsSource="{Binding Friends
}">
<StackPanel
<TextBlock Text="{Binding Path
=Name}" />
<TextBlock Text
="TEST" />
</StackPanel>
</test:HierarchicalDataTemplate
<ig:HierarchicalDataTemplate x:Name
="template1"
ItemsSource="{Binding Friends}"
<ig:HierarchicalDataTemplate.ItemTemplate
<DataTemplate
<TextBlock Text="{Binding Name}"
/>
</StackPanel
</DataTemplate
</ig:HierarchicalDataTemplate.ItemTemplate
</ig:HierarchicalDataTemplate
</UserControl.Resources
<StackPanel x:Name
="LayoutRoot">
<TextBlock Text="{Binding Name
}"
FontSize
="32" />
<igTree:XamWebTree x:Name="xamTree" ItemsSource="{Binding Friends}" HierarchicalItemTemplate="{StaticResource template1}" CheckBoxVisibility
="Visible"
IsCheckBoxThreeState="True" IsEnabled
="True"
</igTree:XamWebTree
<controls:TreeView ItemsSource="{Binding Friends
ItemTemplate="{StaticResource template12
</controls:TreeView
</
UserControl
---------------------------------------------
code bihind:
using
System;
System.Collections.Generic;
System.Linq;
System.Net;
System.Windows;
System.Windows.Controls;
System.Windows.Documents;
System.Windows.Input;
System.Windows.Media;
System.Windows.Media.Animation;
System.Windows.Shapes;
System.Collections.ObjectModel;
Infragistics.Silverlight.Controls;
namespace
RecursiveBinding
{
public partial class MainPage :
public
MainPage()
InitializeComponent();
Person p = new Person
()
Name =
"Fred"
,
Friends =
new ObservableCollection<Person
>{
new Person{Name="John",Friends=new ObservableCollection<Person
new Person{Name = "Paul"
},
new Person{Name = "Ringo"
}}},
new Person{Name="Alan",Friends=new ObservableCollection<Person
new Person{Name = "Jane",Friends=new ObservableCollection<Person
new Person{Name = "Jane"
new Person{Name = "Julie"
}
};
this
.DataContext = p;
//void xamTree_Loaded(object sender, RoutedEventArgs e)
//{
// XamWebTree tree = (XamWebTree)sender;
// if (tree.XamWebTreeItems.Count() > 0)
// {
// tree.XamWebTreeItems[0].IsExpanded = true;
// }
//}
public class
Person
public string Name { get; set
; }
public ObservableCollection<Person> Friends { get; set