在 WPF 中获取数据网格中的多个选定行? [英] Get the multiple selected Row in data-grid in WPF?
本文介绍了在 WPF 中获取数据网格中的多个选定行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在 WPF 中获得多个数据网格的选择,作为我的业务需求,我在数据网格中有一个客户表,它允许多个选择和单选按钮(全部、已选择、所有但已选择).如果单击选定的或所有未选定的,则我必须仅为在数据网格中选择的那些客户提取数据.请建议解决方案以获取多个选定的数据网格行.
I want to get the multiple selection of data-grid in WPF, as my the business requirement I have a customer table in data grid which allows multiple selection and radio button (ALL, Selected, All but selected). If the selected or all but selected is clicked the I have to pull data only for those customers which are selected in the data- grid. Please advice solution to get multiple selected row of data grid.
谢谢.
推荐答案
以上问题我已经有了解决方案,
I have got a solution for the above question,
//CustomerDTO is the DTO class which has all the column names of Customer Table.
//dgUsers is the data grid.
List<CustomerDTO> customerList ;
for (int i = 0; i < dgUsers.SelectedItems.Count; i++)
{
customerList.Add((CustomerDTO)dgUsers.SelectedItems[i]);
}
谢谢.
这篇关于在 WPF 中获取数据网格中的多个选定行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文