Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
240
Bind + Edit to XElement & Linq
posted

Hi,

I'm new with XamDataGrid and wondering how to do this. My data source is an XElement. I use Linq to bind it with a XamDataGrid such as:

 

Func<string, string, object> convertFunc = (x, y) => {
                                       Type type = Type.GetType(x);
                                       object value = Convert.ChangeType(y, type);
                                       return value; };

var props = from Property in m_tradeDefinition.Elements() select new { Key = Property.Name.ToString(), Value = convertFunc(Property.Attribute("Type").Value, Property.Value) };

m_grid.DataSource = props;

 

Now it all works just fine. However, I can't get my grid to update. My guess is because my DataSource is actually a collection of anonymous type and thus the grid doesn't know how to update its data source.

So, does anyone know a better way of doing this? Better still, how to bind directly to XElement or XML document in general.

Thanks!

Parents
No Data
Reply Children