get value of checkbox from datagrid?

前端 未结 1 1403
长发绾君心
长发绾君心 2021-01-20 22:12

    
        
            

        
1条回答
  •  情歌与酒
    2021-01-20 22:56

    You can't access the checkbox this way, because there may be more than one of them, the name is valid only inside the DataTemplate.

    In the event handler, the sender parameter should be the CheckBox, you just have to cast it and then you can access the IsChecked property. Another option would be to handle the Checked and Uncheked events.

    But I think a better way would be to handle this in the bound class, not in code-behind of your GUI, separation of concerns and all that.

    0 讨论(0)
提交回复
热议问题