Search code examples
c#xamluwpuwp-xamlnarrator

Narrator. Is there an alternative DialogContent?


I have many Custom and UserControl in my app.

For DialogContent the Narrator reads only inside the control using key combination "Caps Lock" + "Arrow", but for the CustomControl and UserControl the narrator read all automation tree (outside control).

How can I make CustomControl with characteristics DialogContent (reads only inside the control)?

Is there an alternative DialogContent?

Example using ContentDialog + Narrator + Key combination "CapsLock" + "Arrow"


Solution

  • You can use XAML attached properties in the AutomationProperties Class. In your case, you can set AutomationProperties.AccessibilityView="Raw" on any pieces of your custom control to prevent Narrator from accessing those pieces.

    The main scenario for using this property is to deliberately omit certain controls in a template from the UI Automation views, because they don't meaningfully contribute to the accessibility view of the entire control. For example, if you look at the default control templates, you'll often see this XAML attribute applied to either a ContentPresenter or TextBlock that's part of a control composition, setting AutomationProperties.AccessibilityView to "Raw". If this hadn't been done, either the document view or control view would see these parts as distinct UI Automation elements and not as unimportant control parts. The "raw "view of a UI Automation tree is typically only consumed by automation tools or special modes in some of the more advanced assistive technology products. (Source: MSDN)