change - 登录密码框禁止复制粘贴

master
wenjy 2 years ago
parent ac335160a9
commit 2260b97993

@ -47,8 +47,12 @@
<StackPanel Grid.Row="1" Orientation="Horizontal">
<Label Content="请刷卡" Width="50" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<PasswordBox Height="23" HorizontalAlignment="Left" Name="password" VerticalContentAlignment="Center" Width="120" PasswordChar="*" KeyDown="password_KeyDown"/>
<!--禁止复制粘贴-->
<PasswordBox Height="23" HorizontalAlignment="Left" Name="password" VerticalContentAlignment="Center" Width="120" PasswordChar="*" KeyDown="password_KeyDown">
<PasswordBox.CommandBindings>
<CommandBinding Command="ApplicationCommands.Paste" Executed="CommandBinding_Executed" CanExecute="CommandBinding_CanExecute"/>
</PasswordBox.CommandBindings>
</PasswordBox>
</StackPanel>
</Grid>

@ -98,6 +98,21 @@ namespace MaterialTraceabilityUI
}
});
}
/// <summary>
/// 禁止粘贴
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void CommandBinding_CanExecute(object sender, CanExecuteRoutedEventArgs e)
{
e.Handled = true;
}
private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
{
}
//---------------------------------------------
//private void password_KeyDown(object sender, KeyEventArgs e)
//{

Loading…
Cancel
Save