【问题标题】:Stop Screen Reader to read my control type in WPF停止屏幕阅读器以在 WPF 中读取我的控件类型
【发布时间】:2021-01-18 08:08:33
【问题描述】:

我有一个具有需求和辅助功能的旧 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 的所有属性都不起作用。

【问题讨论】:

  • 也许叙述者正在使用反射来读取类型,因此给出了“单选按钮”。也许扩展叙述者或阅读如何为叙述者提供不同的标题

标签: c# wpf narrator


【解决方案1】:

我的理解是旁白会阅读广告类型,以便依赖屏幕阅读器的人知道如何与焦点项目进行交互。

如果您确实需要控制其工作方式,则需要继承 RadioButton 并覆盖 OnCreateAutomationPeer 以创建您自己的对等点,从而获得相当多的控制权。

【讨论】:

    猜你喜欢
    • 2012-03-11
    • 1970-01-01
    • 2012-04-11
    • 2017-11-10
    • 1970-01-01
    • 2013-10-20
    • 2013-03-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多