c#WPF获取listview的多选行的值

时间:2016-09-16 06:29:24

标签: c# listview

我使用此代码,但它返回System.Data.DataRowView而不是多选行的列值

foreach (var item in myListView.SelectedItems)
{
    //do something with the values, maybe add to a list?
}

1 个答案:

答案 0 :(得分:3)

foreach (var item in myListView.SelectedItems)
{
    DataRowView dr = (DataRowView)item ;
   var sValue = dr.Row["columnName"] as string;
}