复选框的选择 [英] Selection of CheckBox

查看:61
本文介绍了复选框的选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我使用复选框创建了数据表,即每一行都有一个复选框.我需要知道如何选择和取消选择特定的行,它也应该反映在数据表中.在此先感谢:)

Hi,

I created the datatable with checkboxes i.e. I have one check box for each row. I need to know how to select and deselect a particular row and it should be reflected in data table also. Thanks in advance :)

推荐答案

madhu333写道:
madhu333 wrote:

我用以下方法创建了数据表:复选框

I created the datatable with checkboxes



这样对吗?我想你应该重新表述你的问题.



Is this correct? I think you should rephrase your question.


它的代码
<Window x:Class="WpfApplication5.Window1"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Title="Window1" Height="300" Width="300">
    <StackPanel Margin="8">
    <ListView

      Name="listView"



      ItemsSource="{Binding}"

      >
      <ListView.View>
        <GridView>
          <GridViewColumn Header="ID" DisplayMemberBinding="{Binding ID}" />
          <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}" />
          <GridViewColumn Header="Balance" Width="140">


            <GridViewColumn.CellTemplate>
              <DataTemplate>

                <CheckBox Tag="{Binding}" Name="Complete" IsThreeState="False" Checked="onButtonClick" />


              </DataTemplate>
            </GridViewColumn.CellTemplate>
          </GridViewColumn>
        </GridView>
      </ListView.View>
    </ListView>

    <Button Margin="4,10">GetAllEvents</Button>


  </StackPanel>
</Window>




我在.cs文件中创建了数据表
因此,我在该数据表中选择了一个复选框
如果选中该复选框,则必须选择相应的行.




i created the data table in .cs file
So i havr check box in that data table
if i select that check box i have to select the corresponding row.


这篇关于复选框的选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆