当我单击全选时,如何单击所有复选框,当取消选中全选时应取消选中。请告诉我 。
<ListBox ItemsSource="{Binding Inputbinding}" >
<CheckBox x:Name="chkSelectAll" Content="Select All" />
<CheckBox x:Name="chkjon" Content="Jon" />
<CheckBox x:Name="chkbob" Content="Bob" />
<CheckBox x:Name="chkmary" Content="Mary" />
</ListBox>
<Button x:Name="btnUserName" Height="25" Margin="0,10,10,0"
IsEnabled="{Binding Path=IsButtonEnabled,Mode=TwoWay}" Click="BtnInput_Click" >
<TextBlock >Submit</TextBlock>
</Button>
答案 0 :(得分:0)
试试这个:
<CheckBox x:Name="chkSelectAll" Content="Select All" />
<CheckBox x:Name="chkjon" Content="Jon" IsChecked="{Binding IsChecked,ElementName=chkSelectAll,Mode=OneWay}" />
<CheckBox x:Name="chkbob" Content="Bob" IsChecked="{Binding IsChecked,ElementName=chkSelectAll,Mode=OneWay}" />
<CheckBox x:Name="chkmary" Content="Mary" IsChecked="{Binding IsChecked,ElementName=chkSelectAll,Mode=OneWay}" />