Hi.
I have a treeview with 3 levels in depth, first time everything looks fine, but when adding to a lower level then the root, it's not reflected.
These are my templates
This is my Level1 class
level 2 and 3 are basicly the same
in the viewmodel file this it treeRoot:
when add items directly to treeRoot there is no problem.
But if I try to update in level2 like this:
But the treeview is not updated, what am I missing?
After I have add I can look in treeView and see that the new item has been added, but just not displayed.
Please help me.
Regards
Rune
I have a treeview with 3 levels in depth, first time everything looks fine, but when adding to a lower level then the root, it's not reflected.
<
telerik:RadTreeView
Margin
=
"8"
ItemsSource
=
"{Binding treeRoot}"
ItemTemplate
=
"{StaticResource Level1Template}"
IsLineEnabled
=
"True"
SelectionChanged
=
"JobDesign_SelectionChanged"
x:Name
=
"JobDesign"
/>
These are my templates
<
HierarchicalDataTemplate
x:Key
=
"Level3Template"
>
<
TextBlock
Text
=
"{Binding Name}"
/>
</
HierarchicalDataTemplate
>
<
HierarchicalDataTemplate
x:Key
=
"Level2Template"
ItemTemplate
=
"{StaticResource Level3Template}"
ItemsSource
=
"{Binding Level3}"
>
<
TextBlock
Text
=
"{Binding Name}"
/>
</
HierarchicalDataTemplate
>
<
HierarchicalDataTemplate
x:Key
=
"Level1Template"
ItemTemplate
=
"{StaticResource Level2Template}"
ItemsSource
=
"{Binding Level2}"
>
<
TextBlock
Text
=
"{Binding Name}"
/>
</
HierarchicalDataTemplate
>
This is my Level1 class
public class Level1
{
public Level1()
{
this.Level2 = new List<
Level2
>();
}
public string Name
{
get;
set;
}
public List<
Level2
> Level2
{
get;
set;
}
}
level 2 and 3 are basicly the same
in the viewmodel file this it treeRoot:
public ObservableCollection<
Level1
> treeRoot { get; private set; }
when add items directly to treeRoot there is no problem.
But if I try to update in level2 like this:
Level1 jobPlanning = treeRoot.Where(t => t.Name.Equals("Job Planning")).Single();
jobPlanning.Level2 = new List<
Level2
>();
Level2 operation = new Level2()
{
Name = "New Item"
};
this.OnPropertyChanged(() => this.treeRoot);
But the treeview is not updated, what am I missing?
After I have add I can look in treeView and see that the new item has been added, but just not displayed.
Please help me.
Regards
Rune