Get cell values from a WPF datagrid that has been populated with anonymous types

£可爱£侵袭症+ 提交于 2020-01-06 12:36:33

问题


I have a datagrid that I populated with 2 arrays of strings by following the process as outlined in this question here

Now when Im trying to get selected cell values im struggling with pulling the cell values back out.

So far I have:

IList rows = dgMain.SelectedItems;

Which returns a list of the selected items, where the first item contains an object with the username and password.

My question is how do I access the username and password? I guess I need to cast the object in the list to something that will allow me to call .UserName and .Password on it?

Please let me know if you need anymore information.

来源:https://stackoverflow.com/questions/13010961/get-cell-values-from-a-wpf-datagrid-that-has-been-populated-with-anonymous-types

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!