mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
WIP Top Menu
This commit is contained in:
@@ -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>
|
||||
|
79
ModernKeePass/Views/UserControls/TopMenuUserControl.xaml
Normal file
79
ModernKeePass/Views/UserControls/TopMenuUserControl.xaml
Normal 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>
|
92
ModernKeePass/Views/UserControls/TopMenuUserControl.xaml.cs
Normal file
92
ModernKeePass/Views/UserControls/TopMenuUserControl.xaml.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user