RowAutomationEventArgs Class
Stores data for the AutomationRequested attached event when the target row, group row, or detail row is focused.
Namespace: DevExpress.Xpf.Grid.Automation
Assembly: DevExpress.Xpf.Grid.v25.2.dll
Declaration
Remarks
Use the RowAutomationEventArgs class to read or modify values announced by screen readers when the target row, group row, or detail row is focused.
Related Event
The AutomationRequested attached event allows you to change default values announced by screen readers. The event fires for rows when the NavigationStyle property is set to Row and a GridControl (or related controls) requests a UI Automation value for a focused row.
Example
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);
}
}