Skip to main content
All docs
V25.2
  • RowAutomationEventArgs.Row Property

    Gets the target row.

    Namespace: DevExpress.Xpf.Grid.Automation

    Assembly: DevExpress.Xpf.Grid.v25.2.dll

    Declaration

    public object Row { get; }

    Property Value

    Type Description
    Object

    The target row data object.

    Remarks

    The following code example handles the AutomationRequested event and changes values announced by a screen reader app when the target row is focused:

    <dxg:GridControl ItemsSource="{Binding Items}">
        <dxg:GridControl.View>
            <dxg:TableView
                x:Name="tableView"
                NavigationStyle="Row"
                dxg:GridAutomationHelper.AutomationRequested="OnAutomationRequested"/>
        </dxg:GridControl.View>
    </dxg:GridControl>
    
    using DevExpress.Xpf.Grid;
    using DevExpress.Xpf.Grid.Automation;
    
    void OnAutomationRequested(object sender, AutomationEventArgs e) {
        if (e is RowAutomationEventArgs rowArgs) {
            var grid = rowArgs.DataControl as GridControl;
            var view = grid?.View as TableView;
            if (view == null)
                return;
    
            // Skip special rows
            if (rowArgs.RowHandle == DataControlBase.NewItemRowHandle ||
                rowArgs.RowHandle == DataControlBase.InvalidRowHandle)
                return;
    
            // "Header1 Value1, Header2 Value2, ..."
            var parts = view.VisibleColumns.Select(c => {
                var header = c.HeaderCaption ?? c.FieldName;
                var value  = view.GetCellValue(rowArgs.RowHandle, c);
                return $"{header} {value}";
            });
    
            e.AutomationValue = string.Join(", ", parts);
        }
    }
    
    See Also