Created a sub style for textbox with buttons in EntryDetailPage

Set long forgotten resources for buttons tooltips
This commit is contained in:
BONNEVILLE Geoffroy
2018-07-26 17:58:34 +02:00
parent 5d9831efb5
commit 89d43e21eb
5 changed files with 42 additions and 19 deletions

View File

@@ -1,7 +1,6 @@
using System; using System;
using Windows.UI.Xaml; using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
namespace ModernKeePass.Controls namespace ModernKeePass.Controls
{ {

View File

@@ -9,7 +9,7 @@
<Setter Property="Foreground" Value="{ThemeResource TextBoxForegroundThemeBrush}" /> <Setter Property="Foreground" Value="{ThemeResource TextBoxForegroundThemeBrush}" />
<Setter Property="Background" Value="{ThemeResource TextBoxBackgroundThemeBrush}" /> <Setter Property="Background" Value="{ThemeResource TextBoxBackgroundThemeBrush}" />
<Setter Property="BorderBrush" Value="{ThemeResource TextBoxBorderThemeBrush}" /> <Setter Property="BorderBrush" Value="{ThemeResource TextBoxBorderThemeBrush}" />
<Setter Property="SelectionHighlightColor" Value="{ThemeResource TextSelectionHighlightColorThemeBrush}" /> <Setter Property="SelectionHighlightColor" Value="{ThemeResource MainColor}" />
<Setter Property="BorderThickness" Value="{ThemeResource TextControlBorderThemeThickness}" /> <Setter Property="BorderThickness" Value="{ThemeResource TextControlBorderThemeThickness}" />
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" /> <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" /> <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
@@ -62,7 +62,7 @@
</ObjectAnimationUsingKeyFrames> </ObjectAnimationUsingKeyFrames>
</Storyboard> </Storyboard>
</VisualState> </VisualState>
<!--<VisualState x:Name="Disabled"> <VisualState x:Name="Disabled">
<Storyboard> <Storyboard>
<DoubleAnimation Storyboard.TargetName="BackgroundElement" <DoubleAnimation Storyboard.TargetName="BackgroundElement"
Storyboard.TargetProperty="Opacity" Storyboard.TargetProperty="Opacity"
@@ -73,7 +73,7 @@
To="0" To="0"
Duration="0" /> Duration="0" />
</Storyboard> </Storyboard>
</VisualState>--> </VisualState>
</VisualStateGroup> </VisualStateGroup>
</VisualStateManager.VisualStateGroups> </VisualStateManager.VisualStateGroups>
<Border x:Name="BorderElement" <Border x:Name="BorderElement"
@@ -194,24 +194,22 @@
Grid.Row="1" Grid.Row="1"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
Margin="{TemplateBinding BorderThickness}" Margin="{TemplateBinding BorderThickness}"
Grid.ColumnSpan="2" Grid.ColumnSpan="2" />
Grid.RowSpan="1"/>
<Border x:Name="BorderElement" <Border x:Name="BorderElement"
Grid.Row="1" Grid.Row="1"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
Grid.ColumnSpan="2" Grid.ColumnSpan="2" Grid.Column="0" />
Grid.RowSpan="1"/>
<ContentPresenter x:Name="HeaderContentPresenter" <ContentPresenter x:Name="HeaderContentPresenter"
Grid.Row="0" Grid.Row="0"
Foreground="{ThemeResource TextBoxForegroundHeaderThemeBrush}" Foreground="{ThemeResource TextBoxForegroundHeaderThemeBrush}"
Margin="0,4,0,4" Margin="0,4,0,4"
Grid.ColumnSpan="2" Grid.ColumnSpan="2" Grid.Column="0"
Content="{TemplateBinding Header}" Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplate="{TemplateBinding HeaderTemplate}"
FontWeight="Semilight" /> FontWeight="Semilight" />
<ScrollViewer x:Name="ContentElement" <ScrollViewer x:Name="ContentElement"
Grid.Row="1" Grid.Row="1" Grid.Column="0"
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}" HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}" VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
@@ -232,7 +230,7 @@
Padding="{TemplateBinding Padding}" Padding="{TemplateBinding Padding}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
IsTabStop="False" IsTabStop="False"
Grid.ColumnSpan="2" Grid.ColumnSpan="2" Grid.Column="0"
Content="{TemplateBinding PlaceholderText}" Content="{TemplateBinding PlaceholderText}"
IsHitTestVisible="False"/> IsHitTestVisible="False"/>
<Button x:Name="ActionButton" <Button x:Name="ActionButton"

View File

@@ -468,4 +468,13 @@
<data name="SearchButtonTooltip.Content" xml:space="preserve"> <data name="SearchButtonTooltip.Content" xml:space="preserve">
<value>Search</value> <value>Search</value>
</data> </data>
<data name="LoginTextBox.ButtonTooltip" xml:space="preserve">
<value>Copy login</value>
</data>
<data name="PasswordTextBox.ButtonTooltip" xml:space="preserve">
<value>Copy password</value>
</data>
<data name="UrlTextBox.ButtonTooltip" xml:space="preserve">
<value>Navigate to URL</value>
</data>
</root> </root>

View File

@@ -468,4 +468,13 @@
<data name="SearchButtonTooltip.Content" xml:space="preserve"> <data name="SearchButtonTooltip.Content" xml:space="preserve">
<value>Rechercher</value> <value>Rechercher</value>
</data> </data>
<data name="LoginTextBox.ButtonTooltip" xml:space="preserve">
<value>Copier le login</value>
</data>
<data name="PasswordTextBox.ButtonTooltip" xml:space="preserve">
<value>Copier le mot de passe</value>
</data>
<data name="UrlTextBox.ButtonTooltip" xml:space="preserve">
<value>Naviguer vers l'URL</value>
</data>
</root> </root>

View File

@@ -357,7 +357,7 @@
<CheckBox IsChecked="{Binding SpacePatternSelected, Mode=TwoWay}" x:Uid="PasswordGeneratorSpace" /> <CheckBox IsChecked="{Binding SpacePatternSelected, Mode=TwoWay}" x:Uid="PasswordGeneratorSpace" />
<CheckBox IsChecked="{Binding SpecialPatternSelected, Mode=TwoWay}" x:Uid="PasswordGeneratorSpecial" /> <CheckBox IsChecked="{Binding SpecialPatternSelected, Mode=TwoWay}" x:Uid="PasswordGeneratorSpecial" />
<CheckBox IsChecked="{Binding BracketsPatternSelected, Mode=TwoWay}" x:Uid="PasswordGeneratorBrackets" /> <CheckBox IsChecked="{Binding BracketsPatternSelected, Mode=TwoWay}" x:Uid="PasswordGeneratorBrackets" />
<TextBlock x:Uid="PasswordGeneratorAlso" Margin="0,5,0,0"/> <TextBlock x:Uid="PasswordGeneratorAlso" Margin="0,5,0,0"/>
<TextBox Text="{Binding CustomChars, Mode=TwoWay}" /> <TextBox Text="{Binding CustomChars, Mode=TwoWay}" />
<Button x:Uid="PasswordGeneratorButton" Command="{Binding GeneratePasswordCommand}" /> <Button x:Uid="PasswordGeneratorButton" Command="{Binding GeneratePasswordCommand}" />
</StackPanel> </StackPanel>
@@ -398,13 +398,21 @@
<StackPanel.Resources> <StackPanel.Resources>
<Style TargetType="TextBlock"> <Style TargetType="TextBlock">
<Setter Property="Margin" Value="0,20,0,0"/> <Setter Property="Margin" Value="0,20,0,0"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="TextWrapping" Value="Wrap"/>
</Style> </Style>
<Style TargetType="CheckBox"> <Style TargetType="CheckBox">
<Setter Property="Margin" Value="0,20,0,0"/> <Setter Property="Margin" Value="0,20,0,0"/>
<Setter Property="FontSize" Value="18"/>
</Style>
<Style BasedOn="{StaticResource TextBoxWithButtonStyle}" TargetType="local:TextBoxWithButton" x:Key="EntryTextBoxWithButtonStyle">
<Setter Property="Width" Value="350"/>
<Setter Property="Height" Value="32"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
</Style> </Style>
</StackPanel.Resources> </StackPanel.Resources>
<TextBlock x:Uid="EntryLogin" TextWrapping="Wrap" FontSize="18" /> <TextBlock x:Uid="EntryLogin" />
<local:TextBoxWithButton HorizontalAlignment="Left" Text="{Binding UserName, Mode=TwoWay}" Width="350" Height="32" Style="{StaticResource TextBoxWithButtonStyle}" SelectionHighlightColor="{StaticResource MainColor}" ButtonSymbol="&#xE16F;" ButtonTooltip="Copy" IsEnabled="{Binding IsSelected}"> <local:TextBoxWithButton x:Uid="LoginTextBox" Text="{Binding UserName, Mode=TwoWay}" Style="{StaticResource EntryTextBoxWithButtonStyle}" ButtonSymbol="&#xE16F;" IsEnabled="{Binding IsSelected}">
<interactivity:Interaction.Behaviors> <interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="ButtonClick"> <core:EventTriggerBehavior EventName="ButtonClick">
<actions:ClipboardAction Text="{Binding UserName}" /> <actions:ClipboardAction Text="{Binding UserName}" />
@@ -412,9 +420,9 @@
</core:EventTriggerBehavior> </core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors> </interactivity:Interaction.Behaviors>
</local:TextBoxWithButton> </local:TextBoxWithButton>
<TextBlock x:Uid="EntryPassword" TextWrapping="Wrap" FontSize="18" /> <TextBlock x:Uid="EntryPassword" />
<PasswordBox HorizontalAlignment="Left" Password="{Binding Password, Mode=TwoWay}" Width="350" Height="32" IsPasswordRevealButtonEnabled="True" Visibility="{Binding IsRevealPassword, Converter={StaticResource InverseBooleanToVisibilityConverter}}" Style="{StaticResource PasswordBoxWithButtonStyle}" IsEnabled="{Binding IsSelected}" /> <PasswordBox HorizontalAlignment="Left" Password="{Binding Password, Mode=TwoWay}" Width="350" Height="32" IsPasswordRevealButtonEnabled="True" Visibility="{Binding IsRevealPassword, Converter={StaticResource InverseBooleanToVisibilityConverter}}" Style="{StaticResource PasswordBoxWithButtonStyle}" IsEnabled="{Binding IsSelected}" />
<local:TextBoxWithButton HorizontalAlignment="Left" Text="{Binding Password, Mode=TwoWay}" Width="350" Height="32" Visibility="{Binding IsRevealPassword, Converter={StaticResource BooleanToVisibilityConverter}}" Style="{StaticResource TextBoxWithButtonStyle}" SelectionHighlightColor="{StaticResource MainColor}" ButtonSymbol="&#xE16F;" ButtonTooltip="Copy" IsEnabled="{Binding IsSelected}"> <local:TextBoxWithButton x:Uid="PasswordTextBox" Text="{Binding Password, Mode=TwoWay}" Visibility="{Binding IsRevealPassword, Converter={StaticResource BooleanToVisibilityConverter}}" Style="{StaticResource EntryTextBoxWithButtonStyle}" ButtonSymbol="&#xE16F;" IsEnabled="{Binding IsSelected}">
<interactivity:Interaction.Behaviors> <interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="ButtonClick"> <core:EventTriggerBehavior EventName="ButtonClick">
<actions:ClipboardAction Text="{Binding Password}" /> <actions:ClipboardAction Text="{Binding Password}" />
@@ -425,16 +433,16 @@
<ProgressBar Value="{Binding PasswordComplexityIndicator, ConverterParameter=0\,128, Converter={StaticResource ProgressBarLegalValuesConverter}}" Maximum="128" Width="350" HorizontalAlignment="Left" Foreground="{Binding PasswordComplexityIndicator, ConverterParameter=128, Converter={StaticResource DoubleToForegroungBrushComplexityConverter}}" /> <ProgressBar Value="{Binding PasswordComplexityIndicator, ConverterParameter=0\,128, Converter={StaticResource ProgressBarLegalValuesConverter}}" Maximum="128" Width="350" HorizontalAlignment="Left" Foreground="{Binding PasswordComplexityIndicator, ConverterParameter=128, Converter={StaticResource DoubleToForegroungBrushComplexityConverter}}" />
<CheckBox x:Uid="EntryShowPassword" HorizontalAlignment="Left" Margin="-3,0,0,0" IsChecked="{Binding IsRevealPassword, Mode=TwoWay}" IsEnabled="{Binding IsRevealPasswordEnabled}" /> <CheckBox x:Uid="EntryShowPassword" HorizontalAlignment="Left" Margin="-3,0,0,0" IsChecked="{Binding IsRevealPassword, Mode=TwoWay}" IsEnabled="{Binding IsRevealPasswordEnabled}" />
<TextBlock TextWrapping="Wrap" Text="URL" FontSize="18"/> <TextBlock TextWrapping="Wrap" Text="URL" FontSize="18"/>
<local:TextBoxWithButton HorizontalAlignment="Left" Text="{Binding Url, Mode=TwoWay}" Height="32" Width="350" MaxLength="256" Style="{StaticResource TextBoxWithButtonStyle}" SelectionHighlightColor="{StaticResource MainColor}" ButtonSymbol="&#xE111;" ButtonTooltip="Navigate to URL" IsEnabled="{Binding IsSelected}"> <local:TextBoxWithButton x:Uid="UrlTextBox" Text="{Binding Url, Mode=TwoWay}" MaxLength="256" Style="{StaticResource EntryTextBoxWithButtonStyle}" ButtonSymbol="&#xE111;" IsEnabled="{Binding IsSelected}">
<interactivity:Interaction.Behaviors> <interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="ButtonClick"> <core:EventTriggerBehavior EventName="ButtonClick">
<actions:NavigateToUrlAction Url="{Binding Url}" /> <actions:NavigateToUrlAction Url="{Binding Url}" />
</core:EventTriggerBehavior> </core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors> </interactivity:Interaction.Behaviors>
</local:TextBoxWithButton> </local:TextBoxWithButton>
<TextBlock x:Uid="EntryNotes" TextWrapping="Wrap" FontSize="18" /> <TextBlock x:Uid="EntryNotes" />
<TextBox HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding Notes, Mode=TwoWay}" Width="350" Height="200" AcceptsReturn="True" IsSpellCheckEnabled="True" IsEnabled="{Binding IsSelected}" /> <TextBox HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding Notes, Mode=TwoWay}" Width="350" Height="200" AcceptsReturn="True" IsSpellCheckEnabled="True" IsEnabled="{Binding IsSelected}" />
<CheckBox x:Uid="EntryExpirationDate" FontSize="18" IsChecked="{Binding HasExpirationDate, Mode=TwoWay}" IsEnabled="{Binding IsSelected}" /> <CheckBox x:Uid="EntryExpirationDate" IsChecked="{Binding HasExpirationDate, Mode=TwoWay}" IsEnabled="{Binding IsSelected}" />
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />