Created an app theme instead of using the System accent colors (which doesn't work in Win 8.1)

Merged two dictionaries into one
Re-added focus on title when editing an entity
This commit is contained in:
BONNEVILLE Geoffroy
2018-07-25 18:08:59 +02:00
parent dd347b56a2
commit 4ae65fdbac
10 changed files with 50 additions and 45 deletions

View File

@@ -6,7 +6,6 @@
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ResourceDictionaries/Globals.xaml" />
<ResourceDictionary Source="ResourceDictionaries/TextBoxWithButtonStyle.xaml" />
<ResourceDictionary Source="ResourceDictionaries/HamburgerButtonStyle.xaml" />
<ResourceDictionary Source="ResourceDictionaries/ListViewLeftIndicatorStyle.xaml" />

View File

@@ -262,11 +262,6 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="ResourceDictionaries\Globals.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Page>
<Page Include="ResourceDictionaries\NoBorderToggleButtonStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

View File

@@ -1,8 +0,0 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<x:Double x:Key="MenuSize">60</x:Double>
<GridLength x:Key="MenuGridLength">60</GridLength>
<SolidColorBrush x:Key="MainColor" Color="{ThemeResource SystemAccentColor}" />
<SolidColorBrush x:Key="TextColor" Color="{ThemeResource SystemColorHighlightTextColor}" />
</ResourceDictionary>

View File

@@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="ToggleButton" x:Name="HamburgerToggleButton">
<Style TargetType="ToggleButton" x:Key="HamburgerToggleButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">

View File

@@ -2,14 +2,25 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="TextBlock" x:Name="TextBlockSettingsHeaderStyle" >
<!-- Common theme values -->
<x:Double x:Key="MenuSize">60</x:Double>
<GridLength x:Key="MenuGridLength">60</GridLength>
<!-- Only available for Windows 10 -->
<!--<SolidColorBrush x:Key="MainColor" Color="{ThemeResource SystemAccentColor}" />
<SolidColorBrush x:Key="TextColor" Color="{ThemeResource SystemColorHighlightTextColor}" />-->
<SolidColorBrush x:Key="MainColor" Color="SlateBlue" />
<SolidColorBrush x:Key="MainColorLight" Color="MediumSlateBlue" />
<SolidColorBrush x:Key="MainColorDark" Color="DarkSlateBlue" />
<SolidColorBrush x:Key="TextColor" Color="WhiteSmoke" />
<Style TargetType="TextBlock" x:Key="TextBlockSettingsHeaderStyle" >
<Setter Property="FontFamily" Value="Segoe UI" />
<Setter Property="FontSize" Value="14.667" />
<Setter Property="FontWeight" Value="SemiLight" />
</Style>
<!-- Custom style for Windows.UI.Xaml.Controls.Primitives.HyperlinkButton -->
<Style TargetType="HyperlinkButton" x:Name="MainColorHyperlinkButton">
<Style TargetType="HyperlinkButton" x:Key="MainColorHyperlinkButton">
<Setter Property="Foreground" Value="{ThemeResource HyperlinkForegroundThemeBrush}" />
<Setter Property="Background" Value="{ThemeResource HyperlinkButtonBackgroundThemeBrush}" />
<Setter Property="BorderBrush" Value="{ThemeResource HyperlinkButtonBorderThemeBrush}" />
@@ -31,7 +42,7 @@
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemAccentColorLight2}" />
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource MainColorLight}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
@@ -39,7 +50,7 @@
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemColorHotlightColor}" />
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource HyperlinkPressedForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
@@ -104,7 +115,7 @@
</Style>
<!-- Custom style for Windows.UI.Xaml.Controls.SearchBox -->
<Style TargetType="SearchBox" x:Name="MainColorSearchBox">
<Style TargetType="SearchBox" x:Key="MainColorSearchBox">
<Setter Property="Background" Value="{ThemeResource SearchBoxBackgroundThemeBrush}" />
<Setter Property="BorderBrush" Value="{ThemeResource AppBarBackgroundThemeBrush}" />
<Setter Property="BorderThickness" Value="{ThemeResource SearchBoxBorderThemeThickness}" />
@@ -143,7 +154,7 @@
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxPointerOverBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchButton" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemAccentColorLight3}" />
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource MainColorLight}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
@@ -632,7 +643,7 @@
</Style>
<!-- Custom style for Windows.UI.Xaml.Controls.ToggleSwitch -->
<Style TargetType="ToggleSwitch" x:Name="MainColorToggleSwitch">
<Style TargetType="ToggleSwitch" x:Key="MainColorToggleSwitch">
<Setter Property="Foreground" Value="{ThemeResource ToggleSwitchForegroundThemeBrush}" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
@@ -940,7 +951,7 @@
</Style>
<!-- Custom style for Windows.UI.Xaml.Controls.ComboBoxItem -->
<Style TargetType="ComboBoxItem" x:Name="MainColorComboBoxItem">
<Style TargetType="ComboBoxItem" x:Key="MainColorComboBoxItem">
<Setter Property="Background" Value="Transparent" />
<Setter Property="TabNavigation" Value="Local" />
<Setter Property="Padding" Value="8,10" />
@@ -959,7 +970,7 @@
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemAccentColorLight3}" />
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource MainColorLight}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
Storyboard.TargetProperty="Foreground">
@@ -1006,7 +1017,7 @@
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="InnerGrid"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemAccentColorLight1}" />
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource MainColorLight}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
Storyboard.TargetProperty="Foreground">
@@ -1030,7 +1041,7 @@
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="InnerGrid"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemAccentColorLight3}" />
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource MainColorLight}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
Storyboard.TargetProperty="Foreground">
@@ -1100,7 +1111,7 @@
</Style>
<!-- Default style for Windows.UI.Xaml.Controls.ComboBox -->
<Style TargetType="ComboBox" x:Name="MainColorComboBox">
<Style TargetType="ComboBox" x:Key="MainColorComboBox">
<Setter Property="Padding" Value="8,0" />
<Setter Property="MinWidth" Value="{ThemeResource ComboBoxThemeMinWidth}" />
<Setter Property="Foreground" Value="{ThemeResource ComboBoxForegroundThemeBrush}" />
@@ -1364,7 +1375,7 @@
</Style>
<!-- Custom style for Windows.UI.Xaml.Controls.DatePicker -->
<Style TargetType="DatePicker" x:Name="MainColorDatePicker">
<Style TargetType="DatePicker" x:Key="MainColorDatePicker">
<Setter Property="Orientation" Value="Horizontal"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
@@ -1436,7 +1447,7 @@
</Style>
<!-- Custom style for Windows.UI.Xaml.Controls.TimePicker -->
<Style TargetType="TimePicker" x:Name="MainColorTimePicker">
<Style TargetType="TimePicker" x:Key="MainColorTimePicker">
<Setter Property="IsTabStop" Value="False" />
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
@@ -1502,9 +1513,9 @@
</Style>
<!-- Custom style for Windows.UI.Xaml.Controls.Button -->
<Style TargetType="Button" x:Name="MainColorButton">
<Setter Property="Background" Value="{ThemeResource SystemAccentColor}" />
<Setter Property="Foreground" Value="{ThemeResource SystemColorHighlightTextColor}"/>
<Style TargetType="Button" x:Key="MainColorButton">
<Setter Property="Background" Value="{ThemeResource MainColor}" />
<Setter Property="Foreground" Value="{ThemeResource TextColor}"/>
<Setter Property="BorderBrush" Value="{ThemeResource ButtonBorderThemeBrush}" />
<Setter Property="BorderThickness" Value="{ThemeResource ButtonBorderThemeThickness}" />
<Setter Property="Padding" Value="12,4,12,4" />
@@ -1524,7 +1535,7 @@
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemAccentColorLight3}" />
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource MainColorLight}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
Storyboard.TargetProperty="Foreground">
@@ -1617,7 +1628,7 @@
<Setter Property="Background" Value="{ThemeResource SliderTrackBackgroundThemeBrush}" />
<Setter Property="BorderBrush" Value="{ThemeResource SliderBorderThemeBrush}" />
<Setter Property="BorderThickness" Value="{ThemeResource SliderBorderThemeThickness}" />
<Setter Property="Foreground" Value="{ThemeResource SystemAccentColor}" />
<Setter Property="Foreground" Value="{ThemeResource MainColor}" />
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
<Setter Property="ManipulationMode" Value="None" />
@@ -1652,7 +1663,7 @@
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalDecreaseRect"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemAccentColorDark1}" />
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource MainColorDark}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalTrackRect"
Storyboard.TargetProperty="Fill">
@@ -1660,7 +1671,7 @@
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalDecreaseRect"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemAccentColorDark1}" />
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource MainColorDark}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalTrackRect"
Storyboard.TargetProperty="Fill">
@@ -1756,7 +1767,7 @@
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalDecreaseRect"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemAccentColorLight1}" />
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource MainColorLight}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalTrackRect"
Storyboard.TargetProperty="Fill">
@@ -1764,7 +1775,7 @@
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalDecreaseRect"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemAccentColorLight1}" />
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource MainColorLight}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalTrackRect"
Storyboard.TargetProperty="Fill">

View File

@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:ModernKeePass.Controls">
<Style TargetType="controls:TextBoxWithButton" x:Name="TextBoxWithButtonStyle">
<Style TargetType="controls:TextBoxWithButton" x:Key="TextBoxWithButtonStyle">
<Setter Property="MinWidth" Value="{ThemeResource TextControlThemeMinWidth}" />
<Setter Property="MinHeight" Value="{ThemeResource TextControlThemeMinHeight}" />
<Setter Property="Foreground" Value="{ThemeResource TextBoxForegroundThemeBrush}" />

View File

@@ -125,6 +125,7 @@ namespace ModernKeePass.ViewModels
try
{
_isOpening = true;
OnPropertyChanged("IsValid");
Database.Open(databaseFile, CreateCompositeKey(), createNew);
await Task.Run(() => RootGroup = Database.RootGroup);
return true;
@@ -145,6 +146,7 @@ namespace ModernKeePass.ViewModels
finally
{
_isOpening = false;
OnPropertyChanged("IsValid");
}
return false;
}

View File

@@ -525,6 +525,9 @@
SaveCommand="{Binding SaveCommand}"
RestoreCommand="{Binding UndoDeleteCommand}">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="EditButtonClick">
<actions:SetupFocusAction TargetObject="{Binding ElementName=TitleTextBox}" />
</core:EventTriggerBehavior>
<core:EventTriggerBehavior EventName="DeleteButtonClick">
<actions:DeleteEntityAction Entity="{Binding}" Command="{Binding NavigationHelper.GoBackCommand, ElementName=PageRoot}" />
</core:EventTriggerBehavior>

View File

@@ -245,6 +245,9 @@
SortEntriesCommand="{Binding SortEntriesCommand}"
SortGroupsCommand="{Binding SortGroupsCommand}">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="EditButtonClick">
<actions:SetupFocusAction TargetObject="{Binding ElementName=TitleTextBox}" />
</core:EventTriggerBehavior>
<core:EventTriggerBehavior EventName="DeleteButtonClick">
<actions:DeleteEntityAction Entity="{Binding}" Command="{Binding NavigationHelper.GoBackCommand, ElementName=PageRoot}" />
</core:EventTriggerBehavior>

View File

@@ -10,21 +10,21 @@
<Button Command="{Binding RestoreCommand, ElementName=UserControl}" Visibility="{Binding RestoreButtonVisibility, ElementName=UserControl}" IsEnabled="{Binding IsRestoreButtonEnabled,ElementName=UserControl}" Click="RestoreButton_Click" Style="{StaticResource NoBorderButtonStyle}" Background="{ThemeResource ToggleButtonBackgroundThemeBrush}" Height="{StaticResource MenuSize}" Padding="25,0,25,0">
<SymbolIcon Symbol="Undo">
<ToolTipService.ToolTip>
<ToolTip x:Uid="TopMenuRestoreButton" RequestedTheme="Dark" />
<ToolTip x:Uid="TopMenuRestoreButton" />
</ToolTipService.ToolTip>
</SymbolIcon>
</Button>
<Button Command="{Binding SaveCommand, ElementName=UserControl}" Style="{StaticResource NoBorderButtonStyle}" Background="{ThemeResource ToggleButtonBackgroundThemeBrush}" Height="{StaticResource MenuSize}" Padding="25,0,25,0">
<SymbolIcon Symbol="Save">
<ToolTipService.ToolTip>
<ToolTip x:Uid="TopMenuSaveButton" RequestedTheme="Dark" />
<ToolTip x:Uid="TopMenuSaveButton" />
</ToolTipService.ToolTip>
</SymbolIcon>
</Button>
<Button Visibility="{Binding SortButtonVisibility, ElementName=UserControl}" Style="{StaticResource NoBorderButtonStyle}" Background="{ThemeResource ToggleButtonBackgroundThemeBrush}" Height="{StaticResource MenuSize}" Padding="25,0,25,0">
<SymbolIcon Symbol="Sort">
<ToolTipService.ToolTip>
<ToolTip x:Uid="TopMenuSortButton" RequestedTheme="Dark" />
<ToolTip x:Uid="TopMenuSortButton" />
</ToolTipService.ToolTip>
</SymbolIcon>
<Button.Flyout>
@@ -34,17 +34,17 @@
</MenuFlyout>
</Button.Flyout>
</Button>
<ToggleButton Command="{Binding EditCommand, ElementName=UserControl}" IsChecked="{Binding IsEditButtonChecked, ElementName=UserControl, Mode=TwoWay}" Click="EditButton_Click" Style="{StaticResource NoBorderToggleButtonStyle}" Height="{StaticResource MenuSize}" Padding="25,0,25,0">
<ToggleButton Command="{Binding EditCommand, ElementName=UserControl}" IsChecked="{Binding IsEditButtonChecked, ElementName=UserControl, Mode=TwoWay}" Checked="EditButton_Click" Style="{StaticResource NoBorderToggleButtonStyle}" Height="{StaticResource MenuSize}" Padding="25,0,25,0">
<SymbolIcon Symbol="Edit">
<ToolTipService.ToolTip>
<ToolTip x:Uid="TopMenuEditButton" RequestedTheme="Dark" />
<ToolTip x:Uid="TopMenuEditButton" />
</ToolTipService.ToolTip>
</SymbolIcon>
</ToggleButton>
<Button Command="{Binding DeleteCommand, ElementName=UserControl}" IsEnabled="{Binding IsDeleteButtonEnabled, ElementName=UserControl}" Visibility="{Binding DeleteButtonVisibility, ElementName=UserControl}" Click="DeleteButton_Click" Style="{StaticResource NoBorderButtonStyle}" Background="{ThemeResource ToggleButtonBackgroundThemeBrush}" Height="{StaticResource MenuSize}" Padding="25,0,25,0">
<SymbolIcon Symbol="Delete">
<ToolTipService.ToolTip>
<ToolTip x:Uid="TopMenuDeleteButton" RequestedTheme="Dark" />
<ToolTip x:Uid="TopMenuDeleteButton" />
</ToolTipService.ToolTip>
</SymbolIcon>
</Button>