Accessibility in Xamarin TreeView (SfTreeView)

18 May 20211 minute to read

The TreeView control has built-in AutomationId for inner elements. The AutomationId API allows the automation framework to find and interact with the inner elements of the TreeView control. To keep unique AutomationId, these inner element’s AutomationIds are updated based on TreeView control AutomationId.

For example, if we set TreeView’s AutomationId as “Automation” then Automation framework will interact with expander icon of TreeNodeItem as AutomationItem1 Expander. Here, along with the control’s AutomationId, index of an item will also be added for differentiating each TreeNodeItem expander.

View AutomationId Format Example
Expander View ControlAutomationId+Item+ItemIndex Expander AutomationItem1 Expander

where Automation represents Control AutomationId, Item1 represents Item text appended with item index which has been generated based on item position and Expander represents the expander dropdown icon.

The following image denotes the AutomationIds of inner elements.

Automation id for expander