单击“全选”时如何单击所有复选框,取消选中“全选”时应取消选中。请告诉我 。
<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>
试试这个:
<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}" />