Hi,
I have bound RadTreeViewItem.ItemsSource to a HierarchicalDataTemplate in TwoWay mode. Now when my underlying DataContext object is changed the associated RadTreeViewItem's properties are also updated but this change does not appear on the screen.
Extracts From XAML Code:
xmlns:my="clr-namespace:MySilverlightUI"
<UserControl.Resources>
<my:MyTreeViewItemCollection x:Key="mobjMyTreeViewItemCollection" />
<telerik:HierarchicalDataTemplate x:Key="tplMyTreeViewItem" ItemsSource="{Binding Path=Items, Mode=TwoWay}">
<TextBlock Height="14" Text="{Binding Path=Header, Mode=TwoWay}" FontSize="10" ></TextBlock>
</telerik:HierarchicalDataTemplate>
</UserControl.Resources>
<telerikNavigation:RadTreeView ......
...... ItemsSource="{Binding Source={StaticResource mobjMyTreeViewItemCollection}} />
Extracts From Code Behind:
public class MyTreeViewItemCollection : ObservableCollection<MyTreeViewItem>
{ }
public class MyTreeViewItem
{
public string Header;
}
Now when I update underlying DataContext object like this:
MyTreeViewItem objDataContext = trnNode.DataContext as MyTreeViewItem;
objDataContext.Header = rsNewHeader;
then it shows that underlying Header is changed but this effect is not shown on screen.
If I update the node's header my self like:
trnNode.Header = rsNewHeader;
then on screen node contents are removed and it shows as blank node;
Please do help, I am unable to find out why it is happening? It should update the screen when underlying header property is changed.
Thanks,
Shifatullah
I have bound RadTreeViewItem.ItemsSource to a HierarchicalDataTemplate in TwoWay mode. Now when my underlying DataContext object is changed the associated RadTreeViewItem's properties are also updated but this change does not appear on the screen.
Extracts From XAML Code:
xmlns:my="clr-namespace:MySilverlightUI"
<UserControl.Resources>
<my:MyTreeViewItemCollection x:Key="mobjMyTreeViewItemCollection" />
<telerik:HierarchicalDataTemplate x:Key="tplMyTreeViewItem" ItemsSource="{Binding Path=Items, Mode=TwoWay}">
<TextBlock Height="14" Text="{Binding Path=Header, Mode=TwoWay}" FontSize="10" ></TextBlock>
</telerik:HierarchicalDataTemplate>
</UserControl.Resources>
<telerikNavigation:RadTreeView ......
...... ItemsSource="{Binding Source={StaticResource mobjMyTreeViewItemCollection}} />
Extracts From Code Behind:
public class MyTreeViewItemCollection : ObservableCollection<MyTreeViewItem>
{ }
public class MyTreeViewItem
{
public string Header;
}
Now when I update underlying DataContext object like this:
MyTreeViewItem objDataContext = trnNode.DataContext as MyTreeViewItem;
objDataContext.Header = rsNewHeader;
then it shows that underlying Header is changed but this effect is not shown on screen.
If I update the node's header my self like:
trnNode.Header = rsNewHeader;
then on screen node contents are removed and it shows as blank node;
Please do help, I am unable to find out why it is happening? It should update the screen when underlying header property is changed.
Thanks,
Shifatullah