accessibilitywinrt-xaml

How can I get the screen reader to read controls that are not tab stops (e.g. static labels)?


I would like for screen readers (Narrator, JAWS, NVDA) to read aloud the text of certain labels on my WinRT/C++ WinUI3 XAML-based windows, so that the sight-impaired user can know the context of the window that they have in the foreground.

I would rather not make these controls a tab stop, since most people will not be using a screen reader, and would not expect the tab control to stop there.

I have been unable to find anything that works so far, and I am thinking I may need to resort to setting the AutomationProperties.Name of the top-level window itself to the text I want read aloud.

Any tips/tricks/pointers in the right direction would be much appreciated.


Solution

  • There are two possible ways here.

    1.Turn on the narrator's mouse mode. enter image description here

    2.Use AutomationProperties.LabeledBy to bind Textblock.

        <StackPanel Orientation="Vertical">
            <TextBlock x:Name="TitleText" Text="please enter your name"  AutomationProperties.AutomationId="id" HorizontalAlignment="Left" />
            <TextBox Width="200" Height="100" HorizontalAlignment="Center" AutomationProperties.LabeledBy="{Binding ElementName=TitleText}"/>
            <Button Content="OK" HorizontalAlignment="Right"/>
        </StackPanel>