Reputation: 1125
I have a WPF Datagrid and I am populating the row numbers for it on the LoadingRow Event:
private void GridAccounts_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.Header = (e.Row.GetIndex() + 1).ToString();
}
It seems that doing this, the blank, new row that shows up at the end of the datagrid shows the incorrect row number until the user clicks into that row. After the user clicks into the row, the LoadingRow event is fired and the correct row number is displayed. Is there a way to show the correct row number before the user clicks into the row? Below is an example image of my error:
Upvotes: 0
Views: 496
Reputation: 184486
I get the right number. Either way, this is the NewItemPlaceholder
, i would just leave it blank, you have the row with that placeholder when e.Row.DataContext == CollectionView.NewItemPlaceholder
evaluates to true
, so you could just do nothing in that case.
Upvotes: 1