Skip to main content
All docs
V25.2
  • AutomationEventArgs.AutomationValue Property

    Gets or sets the automation value that applies to the requested property. This is a dependency property.

    Namespace: DevExpress.Xpf.Grid.Automation

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

    Declaration

    public object AutomationValue { get; set; }

    Property Value

    Type Description
    Object

    The automation value that applies to the requested property.

    Remarks

    The following code example handles the AutomationRequested event and changes values announced by a screen reader app when the target cell or 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) {
        switch(e) {
            case CellAutomationEventArgs cell:
                // Announce "<Header> <Value>" for the focused cell
                var header = cell.Column.HeaderCaption ?? cell.Column.FieldName;
                e.AutomationValue = $"{header} {cell.Cell.Value}";
                break;
    
            case RowAutomationEventArgs row:
                // Announce all visible column values for the focused row
                var view = (row.DataControl as GridControl)?.View as TableView;
                if(view != null) {
                    var parts = view.VisibleColumns
                        .Select(c => $"{c.HeaderCaption ?? c.FieldName} {view.GetCellValue(row.RowHandle, c)}");
                    e.AutomationValue = string.Join(", ", parts);
                }
                break;
        }
    }
    
    See Also