DataView and DataGridTableStyle
-
Hi im using a data view to populate my datagrid but am unable to use DataGridTableStyle. When populating my datagrid directly with a DataTable I set the DataGridTableStyle.MappingName to my DataTable name and am able to change the look of the table and columns without any trouble. When using the dataview i get no errors just a blank datagrid. Is it not possible to use the two together? Here is the code anyway, if someone could spot my mistakes it would be great! **Working Code** DataSet ds = new DataSet(); ds.ReadXml("xml.xml"); DataGrid dg = new DataGrid(); dg.DataSource = ds; dg.DataMember = "Players"; DataGridTableStyle dgts = new DataGridTableStyle(); dgts.MappingName = "Players"; dgts.RowHeadersVisible = false; dgts.PreferredRowHeight = 24; dg.TableStyles.Add(dgts); **Broken Code** DataSet ds = new DataSet(); ds.ReadXml("xml.xml"); DataView dv = new DataView(ds.Tables["Player"]); DataGrid dg = new DataGrid(); dg.DataSource = dv; //dg.DataMember = "Players"; **this line causes error** DataGridTableStyle dgts = new DataGridTableStyle(); dgts.MappingName = "Players"; dgts.RowHeadersVisible = false; dgts.PreferredRowHeight = 24; dg.TableStyles.Add(dgts); the broken code causes no errors just displays an empty grid (if i comment out the DataGridTableStyle code the grid dispalys just fine) Thanks in advance!!