I am looking to get the row number into the RowHeader of the WPF 4 DataGrid so it has an Excel-like column for the row numbers of the DataGrid.
The solution I\'ve se
Edit: Apparently scrolling changes the index so the binding won't work like that...
A (seemingly) clean templating solution:
Xaml:
Converter:
public class RowToIndexConv : IValueConverter
{
#region IValueConverter Members
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
DataGridRow row = value as DataGridRow;
return row.GetIndex() + 1;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
#endregion
}