Identifying the first Row in a DataGrid.

Jul 30, 2009 at 7:55 PM
Edited Jul 30, 2009 at 10:57 PM

Hi,

I have a DataGridRowBehaviour class (inherits from ControlBehaviour). Used this class in the style for the DataGrid.

<local:DataGridRowBehavior x:Key="DataGridRowBehavior" />

<!--DataGrid Editing Row Style-->

<Style x:Key="DataGridEditingRowStyle" TargetType="{x:Type dg:DataGridRow}">

<Setter Property="dg:VisualStateBehavior.VisualStateBehavior" Value="{StaticResource DataGridRowBehavior}" />

<Setter Property="Template" Value="{StaticResource DataGridEditingRowControlTemplate}" />

</Style>

Requirement is, I want to identify the First row of the DataGrid. Based on the first row, I have to adjust the Margin. (Sometimes, I have many DataGrid control in the same window).

Thanks in Advance.

-Mani

Jul 30, 2009 at 10:58 PM
manikandangv wrote:

Hi,

I have a DataGridRowBehaviour class (inherits from ControlBehaviour). Used this class in the style for the DataGrid.

<local:DataGridRowBehavior x:Key="DataGridRowBehavior" />

<!--DataGrid Editing Row Style-->

<Style x:Key="DataGridEditingRowStyle" TargetType="{x:Type dg:DataGridRow}">

<Setter Property="dg:VisualStateBehavior.VisualStateBehavior" Value="{StaticResource DataGridRowBehavior}" />

<Setter Property="Template" Value="{StaticResource DataGridEditingRowControlTemplate}" />

</Style>

Requirement is, I want to identify the First row of the DataGrid. Based on the first row, I have to adjust the Margin. (Sometimes, I have many DataGrid control in the same window).

Thanks in Advance.

-Mani

 Using DataGridRow.GetIndex() method, we have identified the row index number.

Thanks,

Mani