如何将其他类型的集合返回到gridView所选项目

时间:2013-09-19 19:21:41

标签: c# list collections windows-store-apps

我正在使用c#开发Windows应用商店应用。

我的应用中有一个GridView。 gridview的来源是我的班级列表。我为Collection List<>创建了一个类。

GridView的模板中,文本框和图像框都存在。当用户在GridView中选择一个项目时,我想返回我班级的值类型。

例如,用户选择第一项,gridview将为我提供我班级的收藏清单。

我怎么做?

1 个答案:

答案 0 :(得分:0)

if(datagridview.CurrentCell.RowIndex!=-1)
   return datagridview.Rows[datagridview.CurrentCell.RowIndex].DataBoundItem as T // where T is denoted in Collection List<T>.