WIP Top Menu

This commit is contained in:
BONNEVILLE Geoffroy
2018-07-02 18:23:43 +02:00
parent 6d32161312
commit 34f5f2f6c8
7 changed files with 245 additions and 7 deletions

View File

@@ -239,6 +239,9 @@
<Compile Include="Views\UserControls\SymbolPickerUserControl.xaml.cs">
<DependentUpon>SymbolPickerUserControl.xaml</DependentUpon>
</Compile>
<Compile Include="Views\UserControls\TopMenuUserControl.xaml.cs">
<DependentUpon>TopMenuUserControl.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
@@ -374,6 +377,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\UserControls\TopMenuUserControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.8.2.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">

View File

@@ -408,4 +408,16 @@
<data name="AddEntryTooltip.Content" xml:space="preserve">
<value>Create a new entry</value>
</data>
<data name="HamburgerMenuHomeLabel.Text" xml:space="preserve">
<value>Home</value>
</data>
<data name="HamburgerMenuHomeTooltip.Content" xml:space="preserve">
<value>Home</value>
</data>
<data name="HamburgerMenuSettingsLabel.Text" xml:space="preserve">
<value>Settings</value>
</data>
<data name="HamburgerMenuSettingsTooltip.Content" xml:space="preserve">
<value>Settings</value>
</data>
</root>

View File

@@ -408,4 +408,16 @@
<data name="AddEntryTooltip.Content" xml:space="preserve">
<value>Créer une nouvelle entrée</value>
</data>
<data name="HamburgerMenuHomeLabel.Text" xml:space="preserve">
<value>Accueil</value>
</data>
<data name="HamburgerMenuHomeTooltip.Content" xml:space="preserve">
<value>Accueil</value>
</data>
<data name="HamburgerMenuSettingsLabel.Text" xml:space="preserve">
<value>Paramètres</value>
</data>
<data name="HamburgerMenuSettingsTooltip.Content" xml:space="preserve">
<value>Paramètres</value>
</data>
</root>

View File

@@ -243,6 +243,7 @@
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button Grid.Column="0"
Command="{Binding NavigationHelper.GoBackCommand, ElementName=PageRoot}"
@@ -276,7 +277,8 @@
</TextBox>
<userControls:BreadCrumbUserControl ItemsSource="{Binding BreadCrumb}" Margin="5,-5,0,0" />
</StackPanel>
<Button Grid.Column="2" x:Name="SearchButton" Style="{StaticResource NoBorderButtonStyle}" Height="50">
<userControls:TopMenuUserControl x:Name="TopMenu" Grid.Column="2" ShowRestoreButton="{Binding ShowRestore}" />
<Button Grid.Column="3" x:Name="SearchButton" Style="{StaticResource NoBorderButtonStyle}" Height="50">
<SymbolIcon Symbol="Find" />
<Button.Flyout>
<Flyout>
@@ -285,13 +287,11 @@
<Setter Property="Padding" Value="0" />
</Style>
</Flyout.FlyoutPresenterStyle>
<!--<controls:TextBoxWithButton x:Uid="GroupFilter" ButtonSymbol="&#xE16E;" Text="{Binding Filter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="18" VerticalContentAlignment="Center" Width="400" Style="{StaticResource TextBoxWithButtonStyle}" SelectionHighlightColor="{StaticResource MainColor}" IsButtonEnabled="False" />-->
<SearchBox x:Uid="GroupSearch" Width="350" Padding="12" Background="{ThemeResource TextBoxDisabledBackgroundThemeBrush}" BorderThickness="0" FontSize="18" SuggestionsRequested="SearchBox_OnSuggestionsRequested" SearchHistoryEnabled="False" ResultSuggestionChosen="SearchBox_OnResultSuggestionChosen" Style="{StaticResource MainColorSearchBox}" />
</Flyout>
</Button.Flyout>
</Button>
<!--<controls:TextBoxWithButton Grid.Column="2" x:Name="FilterBox" x:Uid="GroupFilter" ButtonSymbol="&#xE16E;" Text="{Binding Filter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="18" VerticalContentAlignment="Center" Width="400" Style="{StaticResource TextBoxWithButtonStyle}" SelectionHighlightColor="{StaticResource MainColor}" IsButtonEnabled="False" />-->
<SearchBox Grid.Column="2" x:Uid="GroupSearch" x:Name="SearchBox" Padding="12" Width="350" Background="{ThemeResource TextBoxDisabledBackgroundThemeBrush}" BorderThickness="0" FontSize="18" SuggestionsRequested="SearchBox_OnSuggestionsRequested" SearchHistoryEnabled="False" ResultSuggestionChosen="SearchBox_OnResultSuggestionChosen" Style="{StaticResource MainColorSearchBox}" />
<SearchBox Grid.Column="3" x:Uid="GroupSearch" x:Name="SearchBox" Padding="12" Width="350" Background="{ThemeResource TextBoxDisabledBackgroundThemeBrush}" BorderThickness="0" FontSize="18" SuggestionsRequested="SearchBox_OnSuggestionsRequested" SearchHistoryEnabled="False" ResultSuggestionChosen="SearchBox_OnResultSuggestionChosen" Style="{StaticResource MainColorSearchBox}" />
</Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="DragDropGroup">
@@ -310,9 +310,12 @@
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="SearchGroup">
<VisualStateGroup x:Name="TopMenuGroup">
<VisualState x:Name="Small">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TopMenu" Storyboard.TargetProperty="VisualState">
<DiscreteObjectKeyFrame KeyTime="0" Value="Small"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchButton" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
</ObjectAnimationUsingKeyFrames>
@@ -326,6 +329,9 @@
</VisualState>
<VisualState x:Name="Large">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TopMenu" Storyboard.TargetProperty="VisualState">
<DiscreteObjectKeyFrame KeyTime="0" Value="Large"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchButton" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
</ObjectAnimationUsingKeyFrames>

View File

@@ -69,9 +69,9 @@
</ListView.HeaderTemplate>
<ListView.FooterTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical" Visibility="{Binding IsButtonVisible, ElementName=UserControl}">
<StackPanel Orientation="Vertical">
<Border BorderBrush="White" BorderThickness="0,0,0,1" />
<Button Padding="0" Height="50" Margin="0" Style="{StaticResource NoBorderButtonStyle}" Background="Transparent" BorderThickness="0" Click="ButtonBase_OnClick">
<Button Padding="0" Height="50" Margin="0" Visibility="{Binding IsButtonVisible, ElementName=UserControl}" Style="{StaticResource NoBorderButtonStyle}" Background="Transparent" BorderThickness="0" Click="ButtonBase_OnClick">
<StackPanel Orientation="Horizontal" Margin="13,0,5,0">
<SymbolIcon Symbol="Add">
<ToolTipService.ToolTip>
@@ -81,6 +81,36 @@
<TextBlock Text="{Binding ButtonLabel, ElementName=UserControl}" FontWeight="SemiBold" TextWrapping="NoWrap" FontSize="16" VerticalAlignment="Center" Margin="30,0,20,0" />
</StackPanel>
</Button>
<Button Padding="0" Height="50" Margin="0" Style="{StaticResource NoBorderButtonStyle}" Background="Transparent" BorderThickness="0">
<StackPanel Orientation="Horizontal" Margin="13,0,5,0">
<SymbolIcon Symbol="Home">
<ToolTipService.ToolTip>
<ToolTip x:Uid="HamburgerMenuHomeTooltip" />
</ToolTipService.ToolTip>
</SymbolIcon>
<TextBlock x:Uid="HamburgerMenuHomeLabel" FontWeight="SemiBold" TextWrapping="NoWrap" FontSize="16" VerticalAlignment="Center" Margin="30,0,20,0" />
</StackPanel>
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:NavigateToPageAction TargetPage="ModernKeePass.Views.MainPage" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</Button>
<Button Padding="0" Height="50" Margin="0" Style="{StaticResource NoBorderButtonStyle}" Background="Transparent" BorderThickness="0">
<StackPanel Orientation="Horizontal" Margin="13,0,5,0">
<SymbolIcon Symbol="Setting">
<ToolTipService.ToolTip>
<ToolTip x:Uid="HamburgerMenuSettingsTooltip" />
</ToolTipService.ToolTip>
</SymbolIcon>
<TextBlock x:Uid="HamburgerMenuSettingsLabel" FontWeight="SemiBold" TextWrapping="NoWrap" FontSize="16" VerticalAlignment="Center" Margin="30,0,20,0" />
</StackPanel>
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:NavigateToPageAction TargetPage="ModernKeePass.Views.SettingsPage" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</Button>
</StackPanel>
</DataTemplate>
</ListView.FooterTemplate>

View File

@@ -0,0 +1,79 @@
<UserControl x:Name="UserControl"
x:Class="ModernKeePass.Views.UserControls.TopMenuUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:converters="using:ModernKeePass.Converters"
mc:Ignorable="d">
<UserControl.Resources>
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
</UserControl.Resources>
<StackPanel Orientation="Horizontal">
<Button x:Name="RestoreButton" x:Uid="TopMenuRestoreButton" Command="{Binding RestoreCommand, ElementName=UserControl}" Visibility="{Binding ShowRestoreButton, ElementName=UserControl, Converter={StaticResource BooleanToVisibilityConverter}}" Style="{StaticResource NoBorderButtonStyle}" Height="50">
<SymbolIcon Symbol="Undo" />
</Button>
<Button x:Name="SaveButton" x:Uid="TopMenuSaveButton" Command="{Binding SaveCommand, ElementName=UserControl}" Style="{StaticResource NoBorderButtonStyle}" Height="50">
<SymbolIcon Symbol="Save" />
</Button>
<Button x:Name="EditButton" x:Uid="TopMenuEditButton" Command="{Binding EditCommand, ElementName=UserControl}" Style="{StaticResource NoBorderButtonStyle}" Height="50">
<SymbolIcon Symbol="Edit" />
</Button>
<Button x:Name="DeleteButton" x:Uid="TopMenuDeleteButton" Command="{Binding DeleteCommand, ElementName=UserControl}" Style="{StaticResource NoBorderButtonStyle}" Height="50">
<SymbolIcon Symbol="Delete" />
</Button>
<Button x:Name="MoreButton" x:Uid="TopMenuMoreButton" Command="{Binding SaveCommand, ElementName=UserControl}" Style="{StaticResource NoBorderButtonStyle}" Height="50">
<SymbolIcon Symbol="More" />
<Button.Flyout>
<MenuFlyout>
<MenuFlyoutItem x:Uid="TopMenuRestoreButton" Command="{Binding RestoreCommand, ElementName=UserControl}" Visibility="{Binding ShowRestoreButton, ElementName=UserControl, Converter={StaticResource BooleanToVisibilityConverter}}" />
<MenuFlyoutItem x:Uid="TopMenuSaveButton" Command="{Binding SaveCommand, ElementName=UserControl}"/>
<MenuFlyoutItem x:Uid="TopMenuEditButton" Command="{Binding EditCommand, ElementName=UserControl}" />
<MenuFlyoutItem x:Uid="TopMenuDeleteButton" Command="{Binding DeleteCommand, ElementName=UserControl}" />
</MenuFlyout>
</Button.Flyout>
</Button>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="MinimizeMenuGroup">
<VisualState x:Name="Small">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="MoreButton" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SaveButton" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="EditButton" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RestoreButton" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DeleteButton" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Large">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="MoreButton" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SaveButton" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="EditButton" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RestoreButton" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DeleteButton" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</StackPanel>
</UserControl>

View File

@@ -0,0 +1,92 @@
using System.Windows.Input;
using Windows.UI.Xaml;
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
namespace ModernKeePass.Views.UserControls
{
public sealed partial class TopMenuUserControl
{
public string VisualState
{
get { return (string)GetValue(VisualStateProperty); }
set
{
SetValue(VisualStateProperty, value);
VisualStateManager.GoToState(this, value, true);
}
}
public static readonly DependencyProperty VisualStateProperty =
DependencyProperty.Register(
"VisualState",
typeof(string),
typeof(TopMenuUserControl),
new PropertyMetadata("Large", (o, args) => { }));
public ICommand SaveCommand
{
get { return (ICommand)GetValue(SaveCommandProperty); }
set { SetValue(SaveCommandProperty, value); }
}
public static readonly DependencyProperty SaveCommandProperty =
DependencyProperty.Register(
"SaveCommand",
typeof(ICommand),
typeof(TopMenuUserControl),
new PropertyMetadata(null, (o, args) => { }));
public ICommand EditCommand
{
get { return (ICommand)GetValue(EditCommandProperty); }
set { SetValue(EditCommandProperty, value); }
}
public static readonly DependencyProperty EditCommandProperty =
DependencyProperty.Register(
"EditCommand",
typeof(ICommand),
typeof(TopMenuUserControl),
new PropertyMetadata(null, (o, args) => { }));
public ICommand DeleteCommand
{
get { return (ICommand)GetValue(DeleteCommandProperty); }
set { SetValue(DeleteCommandProperty, value); }
}
public static readonly DependencyProperty DeleteCommandProperty =
DependencyProperty.Register(
"DeleteCommand",
typeof(ICommand),
typeof(TopMenuUserControl),
new PropertyMetadata(null, (o, args) => { }));
public ICommand RestoreCommand
{
get { return (ICommand)GetValue(RestoreCommandProperty); }
set { SetValue(RestoreCommandProperty, value); }
}
public static readonly DependencyProperty RestoreCommandProperty =
DependencyProperty.Register(
"RestoreCommand",
typeof(ICommand),
typeof(TopMenuUserControl),
new PropertyMetadata(null, (o, args) => { }));
public bool ShowRestoreButton
{
get { return (bool)GetValue(ShowRestoreButtonProperty); }
set { SetValue(ShowRestoreButtonProperty, value); }
}
public static readonly DependencyProperty ShowRestoreButtonProperty =
DependencyProperty.Register(
"ShowRestoreButton",
typeof(bool),
typeof(TopMenuUserControl),
new PropertyMetadata(false, (o, args) => { }));
public TopMenuUserControl()
{
InitializeComponent();
}
}
}