Answer the question
In order to leave comments, you need to log in
WPF Datagrid how to bind multiple fields into one column?
Let's say my class has fields Par1, Par2, Par3.
I need a table with 2 columns, the first will be "Par1", the second will be "Par2 (Par3)"
If the first is implemented simply:
<DataGridTextColumn Binding="{Binding Par1}" Header="{x:Static res:Resources.Header1}" Width="*" SortMemberPath="Par1"/>
Answer the question
In order to leave comments, you need to log in
<DataGridTemplateColumn Header="{x:Static res:Resources.Header2}" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Par2}"></TextBlock>
<TextBlock Text="{Binding Par3}"></TextBlock>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question