代码之家  ›  专栏  ›  技术社区  ›  Tony Vitabile

如何让讲述人在WPF弹出菜单中阅读文本?

  •  0
  • Tony Vitabile  · 技术社区  · 4 年前

    我有一个WPF应用程序,其中包含一个按钮。当你按下按钮时 Popup 打开。这个 弹出菜单 包含有关该会议的信息。

    在“讲述人”打开的情况下 弹出菜单 没有被读取。如何让“讲述人”阅读 弹出菜单 的内容?

    这是的一个样本 弹出菜单 的内容:

    <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>
    

    编辑:的其余部分 弹出菜单 包含更多 TextBlock s和几个用于将链接或所有数据复制到剪贴板的按钮。我没有把它包括在内,因为我认为它不重要。

    0 回复  |  直到 4 年前
        1
  •  2
  •   KingRichard    4 年前

    您需要设置Popup。IsKeyboard专注于真实。默认值为false。

    这会将选项卡焦点移动到弹出窗口。只需记住,当用户关闭弹出窗口时,您需要将焦点向后移动(最好移动到打开弹出窗口的触发器)。

    推荐文章