Files
modernkeepass/ModernKeePass/Views/UserControls/TopMenuUserControl.xaml.cs

158 lines
6.2 KiB
C#
Raw Normal View History

2018-07-02 18:23:43 +02:00
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 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 Visibility RestoreButtonVisibility
2018-07-02 18:23:43 +02:00
{
get { return (Visibility)GetValue(RestoreButtonVisibilityProperty); }
set { SetValue(RestoreButtonVisibilityProperty, value); }
2018-07-02 18:23:43 +02:00
}
public static readonly DependencyProperty RestoreButtonVisibilityProperty =
2018-07-02 18:23:43 +02:00
DependencyProperty.Register(
"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),
2018-07-02 18:23:43 +02:00
typeof(TopMenuUserControl),
new PropertyMetadata(false, (o, args) => { }));
public Visibility MoreButtonVisibility
{
get { return (Visibility)GetValue(MoreButtonVisibilityProperty); }
set { SetValue(MoreButtonVisibilityProperty, value); }
}
public static readonly DependencyProperty MoreButtonVisibilityProperty =
DependencyProperty.Register(
"MoreButtonVisibility",
typeof(Visibility),
typeof(TopMenuUserControl),
new PropertyMetadata(false, (o, args) => { }));
public Visibility OverflowButtonsVisibility
{
get { return (Visibility)GetValue(OverflowButtonsVisibilityProperty); }
set { SetValue(OverflowButtonsVisibilityProperty, value); }
}
public static readonly DependencyProperty OverflowButtonsVisibilityProperty =
DependencyProperty.Register(
"OverflowButtonsVisibility",
typeof(Visibility),
typeof(TopMenuUserControl),
new PropertyMetadata(false, (o, args) => { }));
public bool IsDeleteButtonEnabled
{
get { return (bool)GetValue(IsDeleteButtonEnabledProperty); }
set { SetValue(IsDeleteButtonEnabledProperty, value); }
}
public static readonly DependencyProperty IsDeleteButtonEnabledProperty =
DependencyProperty.Register(
"IsDeleteButtonEnabled",
typeof(bool),
typeof(TopMenuUserControl),
new PropertyMetadata(true, (o, args) => { }));
2018-07-02 18:23:43 +02:00
public bool IsEditButtonChecked
{
get { return (bool)GetValue(IsEditButtonCheckedProperty); }
set { SetValue(IsEditButtonCheckedProperty, value); }
}
public static readonly DependencyProperty IsEditButtonCheckedProperty =
DependencyProperty.Register(
"IsEditButtonChecked",
typeof(bool),
typeof(TopMenuUserControl),
new PropertyMetadata(false, (o, args) => { }));
public event EditButtonClickEventHandler EditButtonClick;
public delegate void EditButtonClickEventHandler(object sender, RoutedEventArgs e);
public event DeleteButtonClickEventHandler DeleteButtonClick;
public delegate void DeleteButtonClickEventHandler(object sender, RoutedEventArgs e);
public event RestoreButtonClickEventHandler RestoreButtonClick;
public delegate void RestoreButtonClickEventHandler(object sender, RoutedEventArgs e);
2018-07-02 18:23:43 +02:00
public TopMenuUserControl()
{
InitializeComponent();
}
private void EditButton_Click(object sender, RoutedEventArgs e)
{
EditButtonClick?.Invoke(sender, e);
}
private void DeleteButton_Click(object sender, RoutedEventArgs e)
{
DeleteButtonClick?.Invoke(sender, e);
}
private void RestoreButton_Click(object sender, RoutedEventArgs e)
{
RestoreButtonClick?.Invoke(sender, e);
}
2018-07-02 18:23:43 +02:00
}
}