I have this code:
private void DataGrid_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
{
var i = 0;
var d = DataContext as TicketExplorerViewModel;
if (d == null) return;
var entityTypes = d.EntityTypes.Select(entityType => new DataGridTextColumn
{
Header = entityType.EntityName,
Binding = new Binding("[" + entityType.Id + "]"),
MinWidth = 60,
});
foreach (var dgtc in entityTypes)
{
DataGrid.Columns.Insert(i + 1, dgtc);
i++;
}
}
Within Binding = new Binding("[" + entityType.Id + "]"),
I need to insert a string or variable to get a custom field.
I do not know how exactly to proceed to do this, I tried some forms that I know, but I had several errors, someone to help?
Thank you!