I want to know how to use the row index as a condition in the same way the column index is used in the code below:
<Style x:Key="DefaultDataGridCell" TargetType="{x:Type DataGridCell}">
<Setter Property="IsTabStop" Value="False" />
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Column.DisplayIndex}" Value="0" />
</MultiDataTrigger.Conditions>
<Setter Property="IsTabStop" Value="True" />
</MultiDataTrigger>
</Style.Triggers>
In this example the entire first column of the DataGrid is tabstop but I only need the first cell of the DataGrid to be tabstop. How can I do it?
There is no property that you can bind to that returns the index of the row but the
DataGridRow
class has aGetIndex()
method that you could call in a converter class:You cannot bind directly to a method though so you will have to use a converter.