1

I've got a WPF application which contains a button. When you press the button, a Popup opens. The Popup contains information about the meeting in question.

With Narrator turned on, the contents of the Popup are not being read. How do I get Narrator to read the Popup's contents?

Here's a sample of the Popup's contents:

<Popup x:Class="ClassApp.UserInterface.Views.Windows.Settings.MeetingDetailsPopup"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:languages="clr-namespace:MyApp.UserInterface.CommonUI.Languages"
             xmlns:converters="clr-namespace:MyApp.Converters"
             xmlns:global="clr-namespace:"
             Height="375"
             mc:Ignorable="d"
             MaxHeight="375"
             MaxWidth="500" 
             StaysOpen="True"
             Placement="MousePoint" 
             Width="500">
    <Border BorderBrush="{StaticResource GrayBrush}"
            Background="{StaticResource TabSelectedBackgroundBrush}"
            BorderThickness="1">
        <Grid Margin="10">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="25"/>
                <ColumnDefinition Width="2*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="35" />
                <RowDefinition Height="35"/>
                <RowDefinition Height="35"/>
                <RowDefinition Height="35"/>
                <RowDefinition Height="Auto"
                               MinHeight="100"/>
                <RowDefinition Height="Auto"
                               MinHeight="40"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid Grid.Column="0"
                  Grid.ColumnSpan="3"
                  Grid.Row="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0"
                           AutomationProperties.AutomationId="ClassName"
                           AutomationProperties.Name="{Binding ClassName}"
                           FontSize="18"
                           FontWeight="Bold"
                           x:Name="ClassName"
                           Style="{StaticResource ClassInformationTextBlockStyle}"
                           Text="{Binding ClassName}"
                           TextWrapping="Wrap"
                           VerticalAlignment="Top"/>
                <Button Grid.Column="1" 
                        AutomationProperties.Name="{x:Static languages:Resources.Accessibility_CloseWindow}"
                        AutomationProperties.AutomationId="CloseWindow"
                        Command="{Binding CloseMeetingInfoCommand}"
                        Content="X"
                        FontSize="16"
                        HorizontalAlignment="Right"
                        x:Name="CloseButton"
                        Style="{StaticResource ClassInformationCloseButtonStyle}"
                        VerticalAlignment="Top"/>
            </Grid>
            <TextBlock Grid.Column="0"
                       Grid.Row="1"
                       AutomationProperties.Name="{x:Static languages:Resources.Label_MeetingID}"
                       FontSize="14"
                       Foreground="{StaticResource GrayBrush}"
                       x:Name="MeetingIdLabel"
                       Style="{StaticResource ClassInformationTextBlockStyle}"
                       Text="{x:Static languages:Resources.Label_MeetingID}"
                       VerticalAlignment="Top"/>
            <TextBlock Grid.Column="2"
                       Grid.Row="1"
                       AutomationProperties.AutomationId="MeetingId"
                       AutomationProperties.Name="{Binding MeetingID}"
                       AutomationProperties.LabeledBy="{Binding ElementName=MeetingIdLabel}"
                       FontSize="14"
                       Style="{StaticResource ClassInformationTextBlockStyle}"
                       Text="{Binding MeetingID}"
                       VerticalAlignment="Top"/>

                . . .
            </Grid>
        </Grid>
    </Border>
</Popup>

EDIT: The rest of the Popup consists of more TextBlocks and a couple of buttons for copying a link or all of the data into the clipboard. I didn't include it because I don't believe it matters.

1 Answer 1

2
+100

You need to set Popup.IsKeyboardFocused to true. The default value is false.

This will move the tab focus to the popup. Just remember that you'll need to move the focus back (preferably to the trigger that opens the popup) when the user closes it.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks! So I set this in the code behind, right?
OK I tried this just now and I found that Popup.IsKeyboardFocused does not have a setter. However, I called Focus() on the Popup and that did it. I added a private field to the backend of the popup to remember which IInputElement had focus before the Popup. This is all working great. The only problem is that the screen reader isn't reading the text in the dialog. It's all in TextBlock controls. I'm going to try using read only TextBoxes to get the text to be read.
I fixed the problem with the TextBlock controls not being read by Narrator by changing them into Label controls and creating a Style for Label controls that uses a TextBlock to display the contents.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.