I want to create a WPF datagrid that spans over multiple rows in one column. Like this:
+-------+----------------+
| Name | Attributes |
+-------+------
Try use DataGridTemplateColumn
. I created sample test class for databinding
public class Test
{
public Test(string name, string attribute1, string attribute2)
{
Name = name;
Attributes = new Attribute(attribute1, attribute2);
}
public string Name { get; set; }
public Attribute Attributes { get; set; }
}
public class Attribute
{
public Attribute(string attribute1, string attribute2)
{
Attribute1 = attribute1;
Attribute2 = attribute2;
}
public string Attribute1 { get; set; }
public string Attribute2 { get; set; }
}
And a datagrid in xaml
And fill it in code-behind
List list = new List();
//populate list with your data here
dataGrid1.DataContext = list;