wpf - 如何让讲述人阅读 WPF 弹出窗口中的文本?
问题描述
我有一个包含按钮的 WPF 应用程序。当您按下按钮时,aPopup
打开。其中Popup
包含有关会议的信息。
开启讲述人后,Popup
不会读取内容。如何让讲述人阅读Popup
的内容?
以下是 的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>
编辑:其余部分Popup
由更多TextBlock
s 和几个按钮组成,用于将链接或所有数据复制到剪贴板。我没有包括它,因为我认为它不重要。
解决方案
您需要将 Popup.IsKeyboardFocused 设置为 true。默认值为假。
这会将选项卡焦点移动到弹出窗口。请记住,当用户关闭它时,您需要将焦点移回(最好是打开弹出窗口的触发器)。
推荐阅读
- python-3.x - 为什么我得到一个意外的关键字参数“calculate_hit_box”
- python - 类问题 - 程序按预期工作,但 Visual Studio 代码突出显示语法错误
- python - 无法使用python脚本保存excel文件
- python - 如何在 SentenceTransformers 中设置代理?
- angular - ng build 在 docker(ubuntu)上失败(找不到模块),但在 windows 10 上工作
- vue.js - 无法在 VueJS 中选择带有 v-model 的 chechbox
- webrtc - 将视频从自定义摄像机发布到 antmedia 服务器
- android - 如何在 Android Studio 中获取 Pixel 5 模拟器
- android - 如何在 Android 上显示非整数版本代码
- cognos - 两个日期字段,一个日期过滤器