How do I add multiple controls to a DataGridTemplateColumn of a datagrid using wpf? How do I add multiple controls to a DataGridTemplateColumn of a datagrid using wpf? wpf wpf

How do I add multiple controls to a DataGridTemplateColumn of a datagrid using wpf?


The DataTemplate should have only one element, I believe - so you should use a Panel to contain the elements, say something like this:

<DataGridTemplateColumn Header="Data" Width="100">    <DataGridTemplateColumn.CellTemplate>         <DataTemplate>             <StackPanel Orientation="Horizontal">                 <Label Name="Description" Content="{Binding Desc}"></Label>                 <Label Name="Camera" Content="{Binding Camera}"></Label>             </StackPanel>         </DataTemplate>    </DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn> 

You could of course use WrapPanel, Grid, or anything else you like - StackPanel just appears to be what you're going for.