Brian Ortiz
Brian Ortiz

Reputation: 1921

Control a TabControl with a TreeView?

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?

Upvotes: 1

Views: 1521

Answers (1)

rudigrobler
rudigrobler

Reputation: 17143

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" />

Upvotes: 1

Related Questions