How to show row index for wpf toolkit datagrid?
datagrid, wpf, wpfdatagrid, wpftoolkit
Solution
you can use a multibinding and a converter to bind to the item in the row and the parent datagrid. then in the converter you look up the position of the row in the datagrids items.
On this page download the sample WPFDatagridWithRowNumbers.zip
Enjoy!
Problem
I just want to add a index column in wpf toolkit `DataGrid` to show row index of each data in the `DataGrid`. How? ``` <dg:DataGrid ItemsSource="{Binding List}" SelectionMode="Extended" IsReadOnly="True" AutoGenerateColumns="False" HorizontalAlignment="Left"> <dg:DataGrid.Columns> **<dg:DataGridTextColumn Header="Row Index"></dg:DataGridTextColumn>** <dg:DataGridTextColumn Header="Branch" Binding="{Binding Branch.Id}"></dg:DataGridTextColumn> <dg:DataGridTextColumn Header="Count" Binding="{Binding RequestCount}"></dg:DataGridTextColumn> </dg:DataGrid.Columns> </dg:DataGrid> ```