Retrieving selected data from DataGrid with IEnumerable<IDictionary> (Silverlight)

Posted by RemiX on Stack Overflow See other posts from Stack Overflow or by RemiX
Published on 2010-06-09T08:54:14Z Indexed on 2010/06/09 9:22 UTC
Read the original article Hit count: 238

I have an application that can dynamically load data into a DataGrid. What's needed is an object of IEnumerable<IDictionary>, and a List<Dictionary<string,object>> is supplied (each Dictionary in the list has exactly the same keys).

The data is loaded into the DataGrid and shown, but now I want to retrieve the data the user has clicked on. Using datagrid.SelectedItem, Silverlight complains it cannot evaluate the variable, not even when type-casted.

I tried keeping the List<Dictionary<string,object>> and retrieving the right data from it using datagrid.SelectedIndex, but this index changes when the DataGrid is sorted.

Does anyone know a solution to this problem?

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about data