我创建了以下内容CustomControl
以显示来自SettingsPane
<UserControl
x:Class="xxx.Flyouts.LCSettings"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="xxx.Flyouts"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignWidth="400">
<Border BorderThickness="1,0,0,0">
<Grid Background="LightGray" >
<Grid.RowDefinitions>
<RowDefinition Height="80"/>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- Header area for panel -->
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Grid.Column="0" Margin="40,0,0,0" >
<Button Click="MySettingsBackClicked" Margin="4,4,0,1" Style="{StaticResource SettingsBackButtonStyle}"/>
<TextBlock Margin="10,0,0,0" FontFamily="{StaticResource PeaSnow}" VerticalAlignment="Center" FontWeight="SemiLight" FontSize="24.6667" Text="General" Foreground="#FF0C0B0B"/>
</StackPanel>
</Grid>
<Grid x:Name="SettingsGrid" Grid.Row="1" Margin="40,33,40,39">
<StackPanel Orientation="Vertical">
<TextBlock x:Name="newPasswordTBlock" Text="New Password" Foreground="Black" FontFamily="Segoe UI" FontWeight="SemiLight" FontSize="20"/>
<PasswordBox x:Name="newPwdBox" IsPasswordRevealButtonEnabled="True" Background="LightGray" LostFocus="OnPasswordLostFocus" />
<TextBlock x:Name="confirmPasswordTBlock" Text="Confirm Password" Foreground="Black" FontFamily="Segoe UI" FontWeight="SemiLight" FontSize="20"/>
<PasswordBox x:Name="confirmPwdBox" IsPasswordRevealButtonEnabled="True" Background="LightGray"/>
<Button x:Name="pwdButton" Content="Ok" HorizontalAlignment="Center" Foreground="Black" FontFamily="Segoe UI" FontWeight="SemiLight" FontSize="20" Click="OnPwdButClicked"/>
<TextBlock x:Name="pwdDescrip" Text="" Foreground="Black" TextWrapping="Wrap" FontFamily="Segoe UI" FontWeight="SemiLight" FontSize="20"/>
<TextBlock x:Name="blankTBlock2" Text="" Foreground="Black" FontFamily="Segoe UI" FontWeight="SemiLight" FontSize="16" TextAlignment="Center" MinHeight="50"/>
</StackPanel>
</Grid>
</Grid>
</Border>
当我单击密码框时,键盘会弹出,但在框外单击时,它不会关闭。我试图在密码框上设置 LostFocus,但是当我在框外单击时不会触发它。我可以看到光标仍在密码框内闪烁。
键盘是否因为它是主页面上的 Flyout 而没有关闭?我该如何解决这个问题?:(