这是我的问题,我有一个带复选框的 ListView ,我想获取所选行的索引 我想获取行的索引以在验证后禁用此行
我尝试不同的方法
CheckBox cbx = sender as CheckBox.tag;
if (cbx != null) {
var index = cbx.Tag.ToString();
}
(((ContentPresenter)((CheckBox)sender).TemplatedParent)).IsEnabled = false; with this i disable just the checkbox
CheckBox cbx = sender as CheckBox.tag;
int index = (int)(sender as CheckBox).Tag;
最佳答案
一行使用下面的代码:
int index = YourListView.SelectedIndex;
关于c# - 带复选框的 ListView 获取选定的行索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30914244/