AutomationEventArgs Class
Stores data for the AutomationRequested attached event.
Namespace: DevExpress.Xpf.Grid.Automation
Assembly: DevExpress.Xpf.Grid.v25.2.dll
Declaration
Remarks
Use the AutomationEventArgs class to read or modify values announced by screen readers.
Related Event
The AutomationRequested attached event allows you to change default values announced by screen reader apps. The event fires when a GridControl (or related controls) requests a UI Automation value for the focused element.
AutomationEventArgs is the base class for the following AutomationRequested event data containers:
- RowAutomationEventArgs
- Stores data for the AutomationRequested attached event when the target row, group row, or detail row is focused.
- CellAutomationEventArgs
- Stores data for the AutomationRequested attached event when the target cell is focused.
- TreeListNodeAutomationEventArgs
- Stores data for the AutomationRequested attached event when the target tree node is focused.
Example
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;
}
}
Inheritance
See Also