I'm looking for a way to control which Tab of a TabView is shown based on which item of a TreeView is selected. Does anyone know of a way to do this?
+1
A:
If the TabControl and the TreeView is bound to the same date source (ItemsSource), you should be able to set the IsSynchronizedWithCurrentItem on the TabControl to keep the 2 in sync... I think you might also have to use the TreeViewEx project, since the TreeView inside WPF does some funny things sometimes... but first give it a go...
<TreeView
ItemsSource="{Binding something}" />
<TabControl
ItemsSource="{Binding something}"
IsSynchronizedWithCurrentItem="True" />
rudigrobler
2010-09-15 05:25:45
What is TreeViewEx?
Brian Ortiz
2010-09-15 19:09:58
Also, it doesn't work. Perhaps because TreeView is not a Selector?
Brian Ortiz
2010-09-15 19:17:52
Search for TreeViewEx, I think it derives from selctor (Not sure) it is also part of the sharpDevelop project!
rudigrobler
2010-09-15 19:52:43
This is a hack but you can also create a behavior that attaches a event handler when a item is selected and then fires a action (Normal behaviors in blend) and then create a action that can set the tab! Althou this uses event handlers, it then makes it totally xaml-able?
rudigrobler
2010-09-15 19:56:21