解说员。有替代的 DialogContent 吗?

Narrator. Is there an alternative DialogContent?

我的应用程序中有很多自定义和用户控件。

对于 DialogContent,讲述人使用组合键 "Caps Lock" + "Arrow" 仅在控件 内读取 , 但对于 CustomControlUserControl,叙述者读取所有自动化树(不受控制)。

如何使 CustomControl 具有 DialogContent 特性(仅在控件内部读取)?

是否有替代的 DialogContent?

您可以在 AutomationProperties Class 中使用 XAML 附加属性。在您的情况下,您可以在自定义控件的任何部分上设置 AutomationProperties.AccessibilityView="Raw" 以防止讲述人访问这些部分。

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)