views:

40

answers:

1

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
Could you please provide me some sample code?
Sauron
Sorry, I must have missed your message. Updated answer with some code, in case it's still useful.
Tiberiu Ana
Thanks, it solved my problem
Sauron