我有一个带有作为父组件的StackPanel(名称为MainStackPanel)的WPF窗体。它有各种各样的groupboxes作为它的孩子。每个组框有两个复选框(checkbox1和checkbox2)。组合框中的复选框控件是父组件面板的子组
现在我想添加一个检查所有按钮到Mainstack面板,单击它时会自动检查每个组中的所有checkbox1。
我是新来WPF和试图找出如何实现这一
<EDIT>
<StackPanel x:Name="MainStackPanel" Orientation="Vertical">
<Grid DataContext="{Binding}">
<Button Content="UnCheck All" Height="23" Name="uncheckall"
Width="75" Margin="434,0,492,0" />
<Button Content="Check All" Height="23" Name="checkall" Width="75"
Margin="175,0,751,0" Click="checkall_Click" />
</Grid>
<GroupBox>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition/>
</Grid.RowDefinitions>
<CheckBox x:Name="checkbox1"
Style="{StaticResource styleCheckBoxLeftSideText}"
IsChecked="{Binding Path=Disabled,
Converter={StaticResource BooleanConverter},
ConverterParameter='false,true'}"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Content="Task Enabled:"
Margin="9,0,0,0"/>
</Grid>
</GroupBox>
</StackPanel>
</EDIT>
到目前为止你做了什么/试过了吗?向我们展示一些代码可以帮助很多。 – 2012-01-17 21:32:31
这里是堆栈面板代码和组框代码。 (组框有一个网格,复选框在网格内) – user1154892 2012-01-17 21:36:54
你有模型支持你的用户界面吗? – 2012-01-17 21:48:22