2009-07-16 64 views

回答

0

将您所有的复选框绑定到相同的属性(从您的ViewModel,你有一个,对吧?)。然后他们都会显示相同的信息。

没有太多的绑定代码..你可以尝试像...

<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是代表你想显示状态的本地属性。

+0

你能否给我提供一些示例代码? – Sauron 2009-07-16 07:36:58

相关问题