I have a tab item with 2 tab pages. I want to place 4 check boxes in each of the tab pages with all check boxes having the same property. How it can be done easily?
A:
Bind all your checkboxes to the same property (from your ViewModel, you do have one, right?). Then they will all display the same information.
There's not much to the binding code.. You could try something like...
<TabControl>
<TabItem Header="Tab1">
<StackPanel>
<CheckBox Content="One" Checked="{Binding Path=MyProperty}"/>
<CheckBox Content="Two" Checked="{Binding Path=MyProperty}"/>
</StackPanel>
</TabItem>
<TabItem Header="Tab2">
<StackPanel>
<CheckBox Content="Three" Checked="{Binding Path=MyProperty}"/>
<CheckBox Content="Four" Checked="{Binding Path=MyProperty}"/>
</StackPanel>
</TabItem>
</TabControl>
..where MyProperty
is a local property representing the state you want to show.
Tiberiu Ana
2009-07-16 07:29:24
Could you please provide me some sample code?
Sauron
2009-07-16 07:36:58
Sorry, I must have missed your message. Updated answer with some code, in case it's still useful.
Tiberiu Ana
2009-07-21 12:09:31
Thanks, it solved my problem
Sauron
2009-07-23 05:43:13