Some layout enhancements

Changed controls to use static or theme resources
Switch to light theme (mainly for testing)
This commit is contained in:
2017-10-05 18:40:24 +02:00
committed by BONNEVILLE Geoffroy
parent c611f5a8a2
commit 4aa3b17398
4 changed files with 53 additions and 57 deletions

2
.gitignore vendored
View File

@@ -33,7 +33,7 @@ _ReSharper*/
Translation/TrlUtil.vshost.exe.manifest Translation/TrlUtil.vshost.exe.manifest
*.nupkg *.nupkg
.vs/ .vs/
/UpgradeLog.htm /UpgradeLog*.htm
packages/ packages/
project.lock.json project.lock.json
AppPackages/ AppPackages/

View File

@@ -2,7 +2,7 @@
x:Class="ModernKeePass.App" x:Class="ModernKeePass.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"> RequestedTheme="Light">
<Application.Resources> <Application.Resources>
<Style TargetType="ToggleButton" x:Name="HamburgerToggleButton"> <Style TargetType="ToggleButton" x:Name="HamburgerToggleButton">
<Setter Property="Template"> <Setter Property="Template">
@@ -18,13 +18,13 @@
<Canvas.Projection> <Canvas.Projection>
<PlaneProjection/> <PlaneProjection/>
</Canvas.Projection> </Canvas.Projection>
<Path x:Name="path" Data="M0,12.997 L30,12.997" Height="3" Stretch="Fill" StrokeThickness="3" Width="28" Stroke="#FF362D2D" StrokeStartLineCap="Square" StrokeEndLineCap="Square" RenderTransformOrigin="0.5,0.5"> <Path x:Name="path" Data="M0,12.997 L30,12.997" Height="3" Stretch="Fill" StrokeThickness="3" Width="28" Stroke="{ThemeResource DefaultTextForegroundThemeBrush}" StrokeStartLineCap="Square" StrokeEndLineCap="Square" RenderTransformOrigin="0.5,0.5">
<Path.RenderTransform> <Path.RenderTransform>
<CompositeTransform/> <CompositeTransform/>
</Path.RenderTransform> </Path.RenderTransform>
</Path> </Path>
<Path Data="M0,12.997 L30,12.997" Height="3" Stretch="Fill" StrokeThickness="3" Width="28" Stroke="#FF362D2D" StrokeStartLineCap="Square" StrokeEndLineCap="Square" Canvas.Top="7"/> <Path Data="M0,12.997 L30,12.997" Height="3" Stretch="Fill" StrokeThickness="3" Width="28" Stroke="{ThemeResource DefaultTextForegroundThemeBrush}" StrokeStartLineCap="Square" StrokeEndLineCap="Square" Canvas.Top="7"/>
<Path x:Name="path1" Data="M0,12.997 L30,12.997" Height="3" Stretch="Fill" StrokeThickness="3" Width="28" Stroke="#FF362D2D" StrokeStartLineCap="Square" StrokeEndLineCap="Square" Canvas.Top="14" RenderTransformOrigin="0.5,0.5"> <Path x:Name="path1" Data="M0,12.997 L30,12.997" Height="3" Stretch="Fill" StrokeThickness="3" Width="28" Stroke="{ThemeResource DefaultTextForegroundThemeBrush}" StrokeStartLineCap="Square" StrokeEndLineCap="Square" Canvas.Top="14" RenderTransformOrigin="0.5,0.5">
<Path.RenderTransform> <Path.RenderTransform>
<CompositeTransform/> <CompositeTransform/>
</Path.RenderTransform> </Path.RenderTransform>

View File

@@ -6,21 +6,21 @@
xmlns:viewModels="using:ModernKeePass.ViewModels" xmlns:viewModels="using:ModernKeePass.ViewModels"
xmlns:converters="using:ModernKeePass.Converters" xmlns:converters="using:ModernKeePass.Converters"
xmlns:local="using:ModernKeePass.Controls" xmlns:local="using:ModernKeePass.Controls"
xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:Core="using:Microsoft.Xaml.Interactions.Core" xmlns:core="using:Microsoft.Xaml.Interactions.Core"
x:Name="PageRoot" x:Name="PageRoot"
x:Class="ModernKeePass.Pages.GroupDetailPage" x:Class="ModernKeePass.Pages.GroupDetailPage"
mc:Ignorable="d" > mc:Ignorable="d" >
<Page.Resources> <Page.Resources>
<SolidColorBrush x:Key="Transparent" Color="Transparent"/> <SolidColorBrush x:Key="Transparent" Color="Transparent"/>
<SolidColorBrush x:Key="White" Color="White"/> <SolidColorBrush x:Key="SystemColor" Color="{StaticResource SystemColorButtonFaceColor}" />
<converters:ColorToBrushConverter x:Key="ColorToBrushConverter"/> <converters:ColorToBrushConverter x:Key="ColorToBrushConverter"/>
<converters:PluralizationConverter x:Key="PluralizationConverter"/> <converters:PluralizationConverter x:Key="PluralizationConverter"/>
</Page.Resources> </Page.Resources>
<Page.DataContext> <Page.DataContext>
<viewModels:GroupVm /> <viewModels:GroupVm />
</Page.DataContext> </Page.DataContext>
<Grid> <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<Grid.Resources> <Grid.Resources>
<CollectionViewSource <CollectionViewSource
x:Name="GroupsViewSource" x:Name="GroupsViewSource"
@@ -29,17 +29,17 @@
x:Name="EntriesViewSource" x:Name="EntriesViewSource"
Source="{Binding Entries}"/> Source="{Binding Entries}"/>
</Grid.Resources> </Grid.Resources>
<!--<Grid.ChildrenTransitions> <Grid.ChildrenTransitions>
<TransitionCollection> <TransitionCollection>
<EntranceThemeTransition/> <EntranceThemeTransition/>
</TransitionCollection> </TransitionCollection>
</Grid.ChildrenTransitions>--> </Grid.ChildrenTransitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="140"/> <RowDefinition Height="140"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- Horizontal scrolling grid --> <!-- Horizontal scrolling grid -->
<SemanticZoom Grid.RowSpan="2" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Padding="0,140,0,0"> <SemanticZoom Grid.Row="1" >
<SemanticZoom.ZoomedInView> <SemanticZoom.ZoomedInView>
<GridView <GridView
x:Name="GridView" x:Name="GridView"
@@ -53,8 +53,8 @@
<DataTemplate x:Name="GroupFirstItem"> <DataTemplate x:Name="GroupFirstItem">
<Border <Border
BorderThickness="2" BorderThickness="2"
BorderBrush="DimGray" BorderBrush="{StaticResource ListViewItemFocusBorderThemeBrush}"
Background="{ThemeResource ListViewItemPlaceholderBackgroundThemeBrush}" Background="{StaticResource HubSectionHeaderPressedForegroundThemeBrush}"
Margin="0,10,0,0" > Margin="0,10,0,0" >
<Grid Height="110" Width="480"> <Grid Height="110" Width="480">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
@@ -62,14 +62,14 @@
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<SymbolIcon Grid.Column="0" Symbol="{Binding IconSymbol}" Width="100" Height="100" /> <SymbolIcon Grid.Column="0" Symbol="{Binding IconSymbol}" Width="100" Height="100" />
<TextBlock Grid.Column="1" Text="{Binding Title}" FontWeight="{Binding FontWeight}" Style="{StaticResource TitleTextBlockStyle}" TextWrapping="NoWrap" VerticalAlignment="Center" Margin="13,0,0,5"/> <TextBlock Grid.Column="1" Text="{Binding Title}" FontWeight="Bold" Style="{ThemeResource TitleTextBlockStyle}" TextWrapping="NoWrap" VerticalAlignment="Center" Margin="13,0,0,5"/>
</Grid> </Grid>
</Border> </Border>
</DataTemplate> </DataTemplate>
<DataTemplate x:Name="GroupOtherItem"> <DataTemplate x:Name="GroupOtherItem">
<Border <Border
BorderThickness="2" BorderThickness="2"
BorderBrush="DimGray" BorderBrush="{StaticResource ListViewItemFocusBorderThemeBrush}"
Background="{Binding BackgroundColor, ConverterParameter={StaticResource Transparent}, Converter={StaticResource ColorToBrushConverter}}" Background="{Binding BackgroundColor, ConverterParameter={StaticResource Transparent}, Converter={StaticResource ColorToBrushConverter}}"
Margin="0,10,0,0" > Margin="0,10,0,0" >
<Grid Height="110" Width="480" > <Grid Height="110" Width="480" >
@@ -79,7 +79,7 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<SymbolIcon Grid.Column="0" Symbol="{Binding IconSymbol}" Width="100" Height="100" /> <SymbolIcon Grid.Column="0" Symbol="{Binding IconSymbol}" Width="100" Height="100" />
<StackPanel Grid.Column="1" VerticalAlignment="Top" Margin="10,0,0,0" > <StackPanel Grid.Column="1" VerticalAlignment="Top" Margin="10,0,0,0" >
<TextBlock Text="{Binding Title}" Style="{StaticResource TitleTextBlockStyle}" TextWrapping="NoWrap" Foreground="{Binding ForegroundColor, ConverterParameter={StaticResource White}, Converter={StaticResource ColorToBrushConverter}}"/> <TextBlock Text="{Binding Title}" Style="{StaticResource TitleTextBlockStyle}" TextWrapping="NoWrap" Foreground="{Binding ForegroundColor, ConverterParameter={StaticResource TextBoxForegroundThemeBrush}, Converter={StaticResource ColorToBrushConverter}}"/>
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" TextWrapping="NoWrap"/> <TextBlock Style="{StaticResource CaptionTextBlockStyle}" TextWrapping="NoWrap"/>
<!--<TextBlock Text="{Binding EntryCount, ConverterParameter=entry\,entries, Converter={StaticResource PluralizationConverter}}" Style="{StaticResource BodyTextBlockStyle}" MaxHeight="60" /> <!--<TextBlock Text="{Binding EntryCount, ConverterParameter=entry\,entries, Converter={StaticResource PluralizationConverter}}" Style="{StaticResource BodyTextBlockStyle}" MaxHeight="60" />
<TextBlock Text="{Binding GroupCount, ConverterParameter=group\,groups, Converter={StaticResource PluralizationConverter}}" Style="{StaticResource BodyTextBlockStyle}" MaxHeight="60" />--> <TextBlock Text="{Binding GroupCount, ConverterParameter=group\,groups, Converter={StaticResource PluralizationConverter}}" Style="{StaticResource BodyTextBlockStyle}" MaxHeight="60" />-->
@@ -109,23 +109,22 @@
<GridView.Header> <GridView.Header>
<ListView <ListView
x:Name="LeftListView" x:Name="LeftListView"
Height="auto"
Width="auto"
Background="LightGray"
Foreground="DarkSlateGray"
SelectionChanged="groups_SelectionChanged" SelectionChanged="groups_SelectionChanged"
IsSwipeEnabled="false" IsSwipeEnabled="false"
IsSynchronizedWithCurrentItem="False" IsSynchronizedWithCurrentItem="False"
DataContext="{Binding DataContext, ElementName=PageRoot}"> DataContext="{Binding DataContext, ElementName=PageRoot}"
RequestedTheme="Dark"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
Foreground="{ThemeResource DefaultTextForegroundThemeBrush}">
<ListView.Resources> <ListView.Resources>
<DataTemplate x:Name="Collapsed"> <DataTemplate x:Name="Collapsed">
<StackPanel Margin="10,0,0,0" Width="30" Orientation="Horizontal" > <StackPanel Width="30" Orientation="Horizontal" Margin="20,0,0,0" >
<SymbolIcon Symbol="{Binding IconSymbol}" /> <SymbolIcon Symbol="{Binding IconSymbol}" />
</StackPanel> </StackPanel>
</DataTemplate> </DataTemplate>
<DataTemplate x:Name="Expanded"> <DataTemplate x:Name="Expanded">
<StackPanel Margin="10,0,0,0" Width="200" Orientation="Horizontal" > <StackPanel Width="200" Orientation="Horizontal" >
<SymbolIcon Symbol="{Binding IconSymbol}" /> <SymbolIcon Symbol="{Binding IconSymbol}" Margin="20,0,0,0" />
<TextBlock Text="{Binding Name}" FontWeight="{Binding FontWeight}" TextWrapping="NoWrap" VerticalAlignment="Center" Margin="30,0,0,0" /> <TextBlock Text="{Binding Name}" FontWeight="{Binding FontWeight}" TextWrapping="NoWrap" VerticalAlignment="Center" Margin="30,0,0,0" />
<!--<TextBlock Text="{Binding EntryCount}" HorizontalAlignment="Right" VerticalAlignment="Center" />--> <!--<TextBlock Text="{Binding EntryCount}" HorizontalAlignment="Right" VerticalAlignment="Center" />-->
</StackPanel> </StackPanel>
@@ -136,7 +135,7 @@
</ListView.ItemsSource> </ListView.ItemsSource>
<ListView.ItemContainerStyle> <ListView.ItemContainerStyle>
<Style TargetType="ListViewItem"> <Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" /> <!--<Setter Property="HorizontalContentAlignment" Value="Stretch" />-->
<Setter Property="VerticalContentAlignment" Value="Stretch" /> <Setter Property="VerticalContentAlignment" Value="Stretch" />
</Style> </Style>
</ListView.ItemContainerStyle> </ListView.ItemContainerStyle>
@@ -145,14 +144,14 @@
<ToggleButton IsChecked="{Binding IsLeftPaneOpen, Mode=TwoWay}" Style="{StaticResource HamburgerToggleButton}" Margin="0" /> <ToggleButton IsChecked="{Binding IsLeftPaneOpen, Mode=TwoWay}" Style="{StaticResource HamburgerToggleButton}" Margin="0" />
</DataTemplate> </DataTemplate>
</ListView.HeaderTemplate> </ListView.HeaderTemplate>
<Interactivity:Interaction.Behaviors> <interactivity:Interaction.Behaviors>
<Core:DataTriggerBehavior Binding="{Binding IsLeftPaneOpen}" Value="True"> <core:DataTriggerBehavior Binding="{Binding IsLeftPaneOpen}" Value="True">
<Core:ChangePropertyAction PropertyName="ItemTemplate" Value="{StaticResource Expanded}"/> <core:ChangePropertyAction PropertyName="ItemTemplate" Value="{StaticResource Expanded}"/>
</Core:DataTriggerBehavior> </core:DataTriggerBehavior>
<Core:DataTriggerBehavior Binding="{Binding IsLeftPaneOpen}" Value="False"> <core:DataTriggerBehavior Binding="{Binding IsLeftPaneOpen}" Value="False">
<Core:ChangePropertyAction PropertyName="ItemTemplate" Value="{StaticResource Collapsed}"/> <core:ChangePropertyAction PropertyName="ItemTemplate" Value="{StaticResource Collapsed}"/>
</Core:DataTriggerBehavior> </core:DataTriggerBehavior>
</Interactivity:Interaction.Behaviors> </interactivity:Interaction.Behaviors>
</ListView> </ListView>
</GridView.Header> </GridView.Header>
</GridView> </GridView>

View File

@@ -1,11 +1,8 @@
using Windows.UI.Xaml.Controls; using Windows.UI.Text;
using Windows.UI.Xaml.Controls;
using ModernKeePass.Mappings; using ModernKeePass.Mappings;
using ModernKeePassLib; using ModernKeePassLib;
using ModernKeePassLib.Security; using ModernKeePassLib.Security;
using Windows.UI.Xaml.Media;
using Windows.UI;
using Windows.UI.Text;
using Windows.UI.Xaml;
namespace ModernKeePass.ViewModels namespace ModernKeePass.ViewModels
{ {
@@ -13,6 +10,9 @@ namespace ModernKeePass.ViewModels
{ {
public GroupVm ParentGroup { get; } public GroupVm ParentGroup { get; }
public PwEntry Entry => _pwEntry; public PwEntry Entry => _pwEntry;
public System.Drawing.Color? BackgroundColor => _pwEntry?.BackgroundColor;
public System.Drawing.Color? ForegroundColor => _pwEntry?.ForegroundColor;
public string Title public string Title
{ {
get get
@@ -42,9 +42,6 @@ namespace ModernKeePass.ViewModels
get { return GetEntryValue(PwDefs.NotesField); } get { return GetEntryValue(PwDefs.NotesField); }
set { SetEntryValue(PwDefs.NotesField, value); } set { SetEntryValue(PwDefs.NotesField, value); }
} }
public System.Drawing.Color? BackgroundColor => _pwEntry?.BackgroundColor;
public System.Drawing.Color? ForegroundColor => _pwEntry?.ForegroundColor;
public Symbol IconSymbol public Symbol IconSymbol
{ {