mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
Bigger database password textbox
Wrong password sets the password box border to red Typing text removes the error Implemented real command bar at the bottom in Groups Search box is always present
This commit is contained in:
@@ -6,8 +6,10 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="60"
|
||||
d:DesignWidth="335" Loaded="UserControl_Loaded">
|
||||
d:DesignWidth="550"
|
||||
Loaded="UserControl_Loaded">
|
||||
<UserControl.Resources>
|
||||
<SolidColorBrush x:Key="ErrorColorBrush" Color="Red"/>
|
||||
<Style TargetType="PasswordBox" x:Name="PasswordBoxWithButtonStyle">
|
||||
<Setter Property="MinWidth" Value="{ThemeResource TextControlThemeMinWidth}" />
|
||||
<Setter Property="MinHeight" Value="{ThemeResource TextControlThemeMinHeight}" />
|
||||
@@ -49,12 +51,12 @@
|
||||
<VisualState x:Name="Pressed">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement"
|
||||
Storyboard.TargetProperty="BorderBrush">
|
||||
Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxButtonPressedBorderThemeBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="GlyphElement"
|
||||
Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxButtonPressedForegroundThemeBrush}" />
|
||||
Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxButtonPointerOverForegroundThemeBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
@@ -230,6 +232,14 @@
|
||||
To="{ThemeResource TextControlPointerOverBorderThemeOpacity}" />
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Error">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement"
|
||||
Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ErrorColorBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Focused" />
|
||||
</VisualStateGroup>
|
||||
<VisualStateGroup x:Name="ButtonStates">
|
||||
@@ -325,7 +335,7 @@
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<StackPanel>
|
||||
<PasswordBox x:Name="PasswordBox" Password="{Binding Password, ElementName=UserControl, Mode=TwoWay}" Width="300" IsPasswordRevealButtonEnabled="True" KeyDown="PasswordBox_KeyDown" PlaceholderText="Password" Style="{StaticResource PasswordBoxWithButtonStyle}"/>
|
||||
<TextBlock x:Name="StatusTextBlock" Margin="20,0" Height="28" Foreground="#FFBF6969" FontSize="14" FontWeight="SemiBold" TextWrapping="WrapWholeWords" />
|
||||
<PasswordBox x:Name="PasswordBox" Password="{Binding Password, ElementName=UserControl, Mode=TwoWay}" Width="500" IsPasswordRevealButtonEnabled="True" KeyDown="PasswordBox_KeyDown" PlaceholderText="Password" Style="{StaticResource PasswordBoxWithButtonStyle}"/>
|
||||
<TextBlock x:Name="StatusTextBlock" Height="28" Foreground="{ThemeResource ErrorColorBrush}" FontSize="14" FontWeight="SemiBold" TextWrapping="WrapWholeWords" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
@@ -56,11 +56,20 @@ namespace ModernKeePass.Controls
|
||||
{
|
||||
ValidationChecked?.Invoke(this, new PasswordEventArgs(app.Database.RootGroup));
|
||||
}
|
||||
else
|
||||
{
|
||||
VisualStateManager.GoToState(PasswordBox, "Error", true);
|
||||
}
|
||||
}
|
||||
|
||||
private void PasswordBox_KeyDown(object sender, KeyRoutedEventArgs e)
|
||||
{
|
||||
if (e.Key == VirtualKey.Enter) OpenButton_OnClick(null, null);
|
||||
else
|
||||
{
|
||||
VisualStateManager.GoToState(PasswordBox, "Normal", true);
|
||||
StatusTextBlock.Text = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||
|
Reference in New Issue
Block a user