Narrator can't read Textblock in UWP app

华 张 136 Reputation points
2022-12-13T03:08:13.337+00:00

I have a popup that contains some control. Now I want the narrator to read "Save Settings(1/6) please name your favorite setting". Because these are TextBlock, can't focus, so the narrator doesn't
work.

269796-image.png

What can I do?

Universal Windows Platform (UWP)
{count} votes

Accepted answer
  1. Roy Li - MSFT 31,826 Reputation points Microsoft Vendor
    2022-12-13T06:56:55.807+00:00

    Hello,

    Welcome to Microsoft Q&A!

    A workaround is that you could use the AutomationProperties.LabeledBy attached property on the form element to reference the labeling TextBlock by its XAML name. After that, when the TextBox is getting focused, the Narrator will read the text of the TextBlock element.

    Example code here:

     <Popup VerticalOffset="10" HorizontalOffset="200" x:Name="StandardPopup" >  
                <Border HorizontalAlignment="Center" VerticalAlignment="Center"  
                    BorderThickness="2" Width="500" Height="200">  
                    <StackPanel >  
                        <TextBlock Text="please name your favorite setting" HorizontalAlignment="Center" x:Name="TitleText" AutomationProperties.AutomationId="please name your favorite setting"/>  
                        <TextBox Width="200" Height="100" HorizontalAlignment="Center"  AutomationProperties.LabeledBy="{Binding ElementName=TitleText}"/>  
                        <Button Content="Close" HorizontalAlignment="Center"/>  
                    </StackPanel>  
                </Border>  
            </Popup>  
    

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful