Q:

Can't edit my datagridview after binding to XML file via linq

Links to 2 similar examples on here which I can't really link to my exact case.
Similalr example 1
Similar Example 2
Here is the code that populates my datagridview...
XElement xdoc = XElement.Load(@"C:\xmltest\test.xml");

            var lines = from item in xdoc.Descendants("line")
                        let fields = item.Elements("field")
                        select new
                        {
                            Name = (string)fields
                                .FirstOrDefault(n => (string)n.Attribute("name") == "Name"),
                            Description = (string)fields
                                .FirstOrDefault(n => (string)n.Attribute("name") == "Description"),
                            ExtraDetails = (string)fields
                                .FirstOrDefault(n => (string)n.Attribute("name") == "ExtraDetails"),

                        };

            dataGridView1.DataSource = lines.ToArray();

This works fine but I can't edit the datagridview after the 'import'.  I have defiantly set the datagridview settings to allow editing etc. The problem seems to be related to the databind in some way.

A:

The problem is that you are projecting the result to anonymous type. The very first line in the documentation link states  

Anonymous types provide a convenient way to encapsulate a set of read-only properties into a single object without having to explicitly define a type first. 

Hope you noticed the read-only word.  
If you want to get editable data, then create your own class with read/write properties and project the query result into it.

