How to show row-number in first column of WPF Datagrid
While searching I found that, row number can be set to RowHeader easily: void datagrid_LoadingRow(object sender, DataGridRowEventArgs e) { e.Row.Header = e.Row.GetIndex(); } It sets row number in RowHeader. But I want to show Row number to first column Can any one help me how can I achieve this? Thanks There might be an easier way to do this but I got it to work by using the GetIndex() method on the DataGridRow class. This returns the index in to the data source so might not be exactly what you're after. the xaml <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com