0
I have this following 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 don’t know exactly how to do this, I tried some ways I know, but I’ve had several mistakes, someone to help?
Thank you!
You said you had mistakes, could post them here?
– gato
Hello #cat, thanks for answering, the mistakes were several more I realized the reason, I’m not able to create a Binding )=. And I don’t know how to proceed, I don’t understand how Binding works exactly, but I’m studying to understand.
– Ana Freitas Telles
Take a look here that might help you.
– gato
Thank you so much! I got it!
– Ana Freitas Telles
@Anafreitastelles If you can, post as answer the solution you found. This way you can help others the same or related doubt.
– Ismael