We have a problem updating the text for a TreeViewItem when the underlying datasource changes.
Here is our xaml (a bit simplified, removed unrelevant code like the "SystemTemplate"):
<UserControl.Resources> |
<telerikControls:HierarchicalDataTemplate x:Key="ChildTemplate" ItemsSource="{Binding System}" ItemTemplate="{StaticResource SystemTemplate}"> |
<TextBlock Text="{Binding Name}" /> |
</telerikControls:HierarchicalDataTemplate> |
<telerikControls:HierarchicalDataTemplate x:Key="ParentTemplate" ItemsSource="{Binding Child}" ItemTemplate="{StaticResource ChildTemplate}"> |
<TextBlock Text="{Binding Name}" /> |
</telerikControls:HierarchicalDataTemplate> |
</UserControl.Resources> |
<Grid x:Name="LayoutRoot" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> |
<telerikNavigation:RadTreeView x:Name="rtvTreeMenu" ItemsSource="{Binding Parents}" |
IsLoadOnDemandEnabled="True" |
ItemTemplate="{StaticResource ParentTemplate}" |
LoadOnDemand="TreeMenu_LoadOnDemand" |
ItemPrepared="TreeMenu_ItemPrepared" |
SelectionChanged="TreeMenu_SelectionChanged" |
SelectedValuePath="{Binding Id}"> |
</telerikNavigation:RadTreeView> |
... |
‘Parents’ is a property of the type ObservableCollection<Parent> in the class the DataContext is bound to, and Child is an ObervableCollection<Child> property in the Parent class.
The user can change the Name property of a Child object (not directly in the TreeView, but another place in the application), thus we need to update the TreeView to show these changes.
We’ve tried to just fire the propertyChanged like this, but nothing happens (although it works when we add a new Child):
propertyChanged(this, new PropertyChangedEventArgs(“Parents”));
Thanks,
Olav