【问题标题】:Make the checkbox checked on selection of Select all in wpf在 wpf 中选择 Select all 时选中复选框
【发布时间】:2017-12-22 15:53:59
【问题描述】:

当我单击 Select All 时如何使所有复选框被单击,当我取消选中 Select all 时它应该取消选择。请告诉我 。

<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>

【问题讨论】:

    标签: wpf checkbox listbox


    【解决方案1】:

    试试这个:

       <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}" />
    

    【讨论】:

      猜你喜欢
      • 2015-10-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-29
      • 1970-01-01
      • 2015-07-19
      • 2011-07-02
      相关资源
      最近更新 更多