I have the following DataTemplate:
<Window.Resources>
<DataTemplate x:Key="MyDataGridCell_TextBox">
<TextBlock Text="{Binding}" />
</DataTemplate>
</Window.Resources>
And the following DataGridColumn in my DataGrid:
<DataGrid ItemsSource="{Binding Logs}">
<DataGrid.Columns>
<DataGridTemplateColumn Header="A" CellTemplate="{StaticResource MyDataGridCell_TextBox}
HOW_DO_I_SET_HERE_DisplayMember_To_PropA???"/>
<DataGridTemplateColumn Header="B" CellTemplate="{StaticResource MyDataGridCell_TextBox}
HOW_DO_I_SET_HERE_DisplayMember_To_PropB???"/>
</DataGrid.Columns>
</DataGrid>
How can I set the DisplayMemberPath of the DataTemplate from DataGridTemplateColumn?
public class Log
{
public string PropA {get;set;}
public string PropB {get;set;}
}
Logs <=> ObservableCollection<Log>
PS: I removed the irrelevant code parts like styles, some props etc. and tried to simplify the code as much as I could.