I have a Silverlight 5 project that needs to use a RadTreeView, currently installed version 2012.2.912.1050
Below is my code, and it's about as simple as I could possibly make it, as far as I know.
My page should show a bound 'Title' component, a separater line, and then the RadTreeView (RTV).
I have a collection called ClientAssets, which is a hierarchical representation of my data, as an ObservableCollection<ClientAsset>. When that collection has been populated in the Setter I also do an OnPropertyChanged. My RTV's itemsource is this collection, and I have my HierarchicalDataTemplate that is bound to my Children collection. Each object has a bunch of other properties, but all I really care about in this example is showing the bound property AssetName, and the Children collection for the tree.
With what I have below (minus the Grid formatting code which has been removed), all I see are the 2 root nodes (which is correct for my test data), with one of them having the expand triangle (it has children). When I expand this item, I see only the space where the two children should reside, but there's nothing there. What am I missing or doing wrong with my setup?
Initially, I thought my collection might be wrong in some way but when I create my own data I get the same thing: Only root nodes with empty space where the children should reside. I have another more complicated example of the RadTreeView in this project, and that works just fine. What am I doing wrong?
Thanks!
Below is my code, and it's about as simple as I could possibly make it, as far as I know.
My page should show a bound 'Title' component, a separater line, and then the RadTreeView (RTV).
I have a collection called ClientAssets, which is a hierarchical representation of my data, as an ObservableCollection<ClientAsset>. When that collection has been populated in the Setter I also do an OnPropertyChanged. My RTV's itemsource is this collection, and I have my HierarchicalDataTemplate that is bound to my Children collection. Each object has a bunch of other properties, but all I really care about in this example is showing the bound property AssetName, and the Children collection for the tree.
With what I have below (minus the Grid formatting code which has been removed), all I see are the 2 root nodes (which is correct for my test data), with one of them having the expand triangle (it has children). When I expand this item, I see only the space where the two children should reside, but there's nothing there. What am I missing or doing wrong with my setup?
Initially, I thought my collection might be wrong in some way but when I create my own data I get the same thing: Only root nodes with empty space where the children should reside. I have another more complicated example of the RadTreeView in this project, and that works just fine. What am I doing wrong?
Thanks!
<
UserControl.Resources
>
<
telerik:HierarchicalDataTemplate
x:Key
=
"NodeTemplate"
ItemsSource
=
"{Binding Children}"
>
<
StackPanel
Orientation
=
"Horizontal"
HorizontalAlignment
=
"Stretch"
>
<
TextBlock
Text
=
"{Binding AssetName}"
Style
=
"{StaticResource Normal}"
/>
</
StackPanel
>
</
telerik:HierarchicalDataTemplate
>
</
UserControl.Resources
>
<
StackPanel
Orientation
=
"Vertical"
Grid.Row
=
"0"
>
<
ContentControl
Content
=
"{Binding Title}"
HorizontalContentAlignment
=
"Stretch"
/>
<
Line
X1
=
"5"
X2
=
"10"
Y1
=
"0"
Y2
=
"0"
Stroke
=
"Gray"
StrokeThickness
=
"1"
Width
=
"Auto"
Stretch
=
"Fill"
/>
<
telerikNav:RadTreeView
HorizontalAlignment
=
"Left"
VerticalAlignment
=
"Top"
Margin
=
"5,10,0,5"
ItemsSource
=
"{Binding ClientAssets}"
x:Name
=
"rtvCA"
ItemTemplate
=
"{StaticResource NodeTemplate}"
>
<
telerikNav:RadTreeView.ItemsPanel
>
<
ItemsPanelTemplate
>
<
StackPanel
VerticalAlignment
=
"Top"
Orientation
=
"Vertical"
/>
</
ItemsPanelTemplate
>
</
telerikNav:RadTreeView.ItemsPanel
>
</
telerikNav:RadTreeView
>
</
StackPanel
>
</
Grid
>