From 056d1af9d095572542934200f80dc8893b3e68d1 Mon Sep 17 00:00:00 2001 From: BONNEVILLE Geoffroy Date: Wed, 4 Jul 2018 18:26:16 +0200 Subject: [PATCH] WIP Top Menu - Button visibility ok when not in menu --- ModernKeePass/Strings/en-US/Resources.resw | 27 +++++++++++ ModernKeePass/Strings/fr-FR/Resources.resw | 27 +++++++++++ ModernKeePass/Views/GroupDetailPage.xaml | 6 ++- .../UserControls/TopMenuUserControl.xaml | 46 ++++++++++++------- .../UserControls/TopMenuUserControl.xaml.cs | 43 ++++++++++++----- 5 files changed, 119 insertions(+), 30 deletions(-) diff --git a/ModernKeePass/Strings/en-US/Resources.resw b/ModernKeePass/Strings/en-US/Resources.resw index ab64136..184bbec 100644 --- a/ModernKeePass/Strings/en-US/Resources.resw +++ b/ModernKeePass/Strings/en-US/Resources.resw @@ -420,4 +420,31 @@ Settings + + Delete + + + Delete + + + Edit + + + Edit + + + More + + + Restore + + + Restore + + + Save + + + Save + \ No newline at end of file diff --git a/ModernKeePass/Strings/fr-FR/Resources.resw b/ModernKeePass/Strings/fr-FR/Resources.resw index 501cef1..60736f6 100644 --- a/ModernKeePass/Strings/fr-FR/Resources.resw +++ b/ModernKeePass/Strings/fr-FR/Resources.resw @@ -420,4 +420,31 @@ Paramètres + + Supprimer + + + Supprimer + + + Editer + + + Editer + + + Plus + + + Restaurer + + + Restaurer + + + Sauvegarder + + + Sauvegarder + \ No newline at end of file diff --git a/ModernKeePass/Views/GroupDetailPage.xaml b/ModernKeePass/Views/GroupDetailPage.xaml index a8d1134..ad1294d 100644 --- a/ModernKeePass/Views/GroupDetailPage.xaml +++ b/ModernKeePass/Views/GroupDetailPage.xaml @@ -277,7 +277,11 @@ - + - - - - diff --git a/ModernKeePass/Views/UserControls/TopMenuUserControl.xaml.cs b/ModernKeePass/Views/UserControls/TopMenuUserControl.xaml.cs index e0cf9c8..2332623 100644 --- a/ModernKeePass/Views/UserControls/TopMenuUserControl.xaml.cs +++ b/ModernKeePass/Views/UserControls/TopMenuUserControl.xaml.cs @@ -10,18 +10,14 @@ namespace ModernKeePass.Views.UserControls public string VisualState { get { return (string)GetValue(VisualStateProperty); } - set - { - SetValue(VisualStateProperty, value); - VisualStateManager.GoToState(this, value, true); - } + set { SetValue(VisualStateProperty, value); } } public static readonly DependencyProperty VisualStateProperty = DependencyProperty.Register( "VisualState", typeof(string), typeof(TopMenuUserControl), - new PropertyMetadata("Large", (o, args) => { })); + new PropertyMetadata("None", (o, args) => { })); public ICommand SaveCommand { @@ -71,18 +67,41 @@ namespace ModernKeePass.Views.UserControls typeof(TopMenuUserControl), new PropertyMetadata(null, (o, args) => { })); - public bool ShowRestoreButton + public Visibility RestoreButtonVisibility { - get { return (bool)GetValue(ShowRestoreButtonProperty); } - set { SetValue(ShowRestoreButtonProperty, value); } + get { return (Visibility)GetValue(RestoreButtonVisibilityProperty); } + set { SetValue(RestoreButtonVisibilityProperty, value); } } - public static readonly DependencyProperty ShowRestoreButtonProperty = + public static readonly DependencyProperty RestoreButtonVisibilityProperty = DependencyProperty.Register( - "ShowRestoreButton", - typeof(bool), + "RestoreButtonVisibility", + typeof(Visibility), typeof(TopMenuUserControl), new PropertyMetadata(false, (o, args) => { })); + public Visibility DeleteButtonVisibility + { + get { return (Visibility)GetValue(DeleteButtonVisibilityProperty); } + set { SetValue(DeleteButtonVisibilityProperty, value); } + } + public static readonly DependencyProperty DeleteButtonVisibilityProperty = + DependencyProperty.Register( + "DeleteButtonVisibility", + typeof(Visibility), + typeof(TopMenuUserControl), + new PropertyMetadata(false, (o, args) => { })); + + public bool EnableDeleteButton + { + get { return (bool)GetValue(EnableDeleteButtonProperty); } + set { SetValue(EnableDeleteButtonProperty, value); } + } + public static readonly DependencyProperty EnableDeleteButtonProperty = + DependencyProperty.Register( + "EnableDeleteButton", + typeof(bool), + typeof(TopMenuUserControl), + new PropertyMetadata(true, (o, args) => { })); public TopMenuUserControl() {