WPF中判断dataGrid的哪一行的checkbox被选中
1个回答
展开全部
代码:
<DataGridCheckBoxColumn Header="操作" Width="10*" Binding="{Binding IsChecked}"/>
<DataGridTextColumn Header="id" Width="10*" Binding="{Binding Path=ui_id, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Visibility="Hidden"/>
<DataGridTextColumn Header="工号" Width="12*" Binding="{Binding Path=ui_number, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<DataGridTextColumn Header="姓名" Width="10*" Binding="{Binding Path=ui_name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
......
点击【删除】后,如何判断是哪一项呗选中?求指教!!!
后台代码:
int count = dataGrid1.Items.Count;
DataRowView[] drv = new DataRowView[count];
DataTable dt = (dataGrid1.ItemsSource as DataView).Table;
for (int i = 0; i < count; i++)
{
drv[i] = dataGrid1.Items[i] as DataRowView;
}
<DataGridCheckBoxColumn Header="操作" Width="10*" Binding="{Binding IsChecked}"/>
<DataGridTextColumn Header="id" Width="10*" Binding="{Binding Path=ui_id, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Visibility="Hidden"/>
<DataGridTextColumn Header="工号" Width="12*" Binding="{Binding Path=ui_number, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<DataGridTextColumn Header="姓名" Width="10*" Binding="{Binding Path=ui_name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
......
点击【删除】后,如何判断是哪一项呗选中?求指教!!!
后台代码:
int count = dataGrid1.Items.Count;
DataRowView[] drv = new DataRowView[count];
DataTable dt = (dataGrid1.ItemsSource as DataView).Table;
for (int i = 0; i < count; i++)
{
drv[i] = dataGrid1.Items[i] as DataRowView;
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询