code_junkie

Where is IsSynchronizedWithCurrentItem property (or equivalent) for a TreeView?

Nov 13th, 2011
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. <TreeView Name="CategoryName" ItemsSource="{Binding Source={StaticResource A_Collection}, Path=RootItems}" />
  2.  
  3. <TextBox Text="{Binding ElementName=CategoryTreeView, Path=SelectedValue.Name}"/>
  4.  
  5. <ListView Name="listView1"
  6. ItemsSource="{Binding Path=SelectedItem.Modules,
  7. ElementName=treeView1, Mode=OneWay}"
  8. IsSynchronizedWithCurrentItem="True">
  9.  
  10. // the XAML
  11. <TreeView DockPanel.Dock="Left" x:Name="tvwNodes" ItemsSource="{Binding}" SelectedItemChanged="OnNewNodeSelected"/>
  12. <ListView x:Name="lvwProperties" ItemsSource="{Binding Path=Properties}"
  13.  
  14. // the code-behind
  15. private void OnNewNodeSelected(object sender, RoutedPropertyChangedEventArgs<object> e)
  16. {
  17. lvwProperties.DataContext = tvwNodes.SelectedItem; // this returns the selected Node obj
  18. }
Add Comment
Please, Sign In to add comment