Arbitrary Header content for each row in WPF datagrid
- by tk
I'm trying to put row header text based on a converter function of the index of the row.
I found a way to bind to the datagridrow like below, but i can't find how to get the row index of the datagridrow object.
<DataTemplate x:Key="MyRowHeaderTemplate" DataType="DataRowView">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Margin="1,0,1,0" Padding="1,0,1,0"
Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGridRow}}, Path=Item}"/>
</DataTemplate>
How can i get the row index and use my converter function to set the row header text?