Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try use <code>DataGridTemplateColumn</code>. I created sample test class for databinding</p> <pre><code>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; } } </code></pre> <p>And a datagrid in xaml</p> <pre><code>&lt;DataGrid AutoGenerateColumns="False" Name="dataGrid1" ItemsSource="{Binding}"&gt; &lt;DataGrid.Columns&gt; &lt;DataGridTemplateColumn Header="Name" &gt; &lt;DataGridTemplateColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;Grid&gt; &lt;TextBlock Text="{Binding Path=Name}" VerticalAlignment="Center" Margin="3,3,3,3"/&gt; &lt;/Grid&gt; &lt;/DataTemplate&gt; &lt;/DataGridTemplateColumn.CellTemplate&gt; &lt;/DataGridTemplateColumn&gt; &lt;DataGridTemplateColumn Header="Attributes" &gt; &lt;DataGridTemplateColumn.CellTemplate&gt; &lt;DataTemplate &gt; &lt;Grid&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="50*"/&gt; &lt;RowDefinition /&gt; &lt;RowDefinition Height="50*"/&gt; &lt;/Grid.RowDefinitions&gt; &lt;TextBlock Grid.Row="0" Text="{Binding Path=Attributes.Attribute1}" VerticalAlignment="Center" Margin="3,3,3,3"/&gt; &lt;Line Grid.Row="1" Stroke="Black" Stretch="Fill" X2="1" VerticalAlignment="Center"/&gt; &lt;TextBlock Grid.Row="2" Text="{Binding Path=Attributes.Attribute2}" VerticalAlignment="Center" Margin="3,3,3,3"/&gt; &lt;/Grid&gt; &lt;/DataTemplate&gt; &lt;/DataGridTemplateColumn.CellTemplate&gt; &lt;/DataGridTemplateColumn&gt; &lt;/DataGrid.Columns&gt; &lt;/DataGrid&gt; </code></pre> <p>And fill it in code-behind</p> <pre><code>List&lt;Test&gt; list = new List&lt;Test&gt;(); //populate list with your data here dataGrid1.DataContext = list; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload