问题描述
我有一个带有需求和辅助功能的旧 WPF 应用程序。该应用程序使用单选按钮来构建一个带有弹出窗口的菜单。
问题是用户不希望叙述者在点击时说“单选按钮”。我正在使用 AutomationProperties.HelpText
和 AutomationProperties.Name
来调整控件的文本。我不知道如何更改当控件处于焦点时叙述者读出的“ControlType”。
<RadioButton
AutomationProperties.AcceleratorKey="1"
AutomationProperties.AccessKey="3"
AutomationProperties.AutomationId="2"
AutomationProperties.HelpText="Taufiq"
AutomationProperties.ItemStatus="Test"
AutomationProperties.ItemType="Text"
AutomationProperties.Name="Take Snapshot"
Command="{Binding TakeSnapshotCommand}">
<StackPanel Orientation="Horizontal">
<ContentControl Content="{DynamicResource galleryIcon}" Focusable="False" />
<TextBlock Text="Take Snapshot" />
</StackPanel>
</RadioButton>
AutomationProperties 的所有属性都不起作用。
解决方法
我的理解是,叙述者会阅读广告类型,以便依赖屏幕阅读器的人知道如何与重点项目进行交互。
如果您确实需要控制其工作方式,则需要子类化 RadioButton
并覆盖 OnCreateAutomationPeer
以创建您自己的对等方,然后可以获得相当多的控制权。