mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
WIP Top Menu - sort buttons present but not working
Removed flyout from textbox with button Generating a new password creates a new history entry Top Menu edit mode now works as intended
This commit is contained in:
@@ -454,6 +454,7 @@
|
||||
<interactivity:Interaction.Behaviors>
|
||||
<core:EventTriggerBehavior EventName="ButtonClick">
|
||||
<actions:ClipboardAction Text="{Binding UserName}" />
|
||||
<actions:ToastAction x:Uid="ToastCopyLogin" Title="{Binding Name}" />
|
||||
</core:EventTriggerBehavior>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
</local:TextBoxWithButton>
|
||||
@@ -463,6 +464,7 @@
|
||||
<interactivity:Interaction.Behaviors>
|
||||
<core:EventTriggerBehavior EventName="ButtonClick">
|
||||
<actions:ClipboardAction Text="{Binding Password}" />
|
||||
<actions:ToastAction x:Uid="ToastCopyPassword" Title="{Binding Name}" />
|
||||
</core:EventTriggerBehavior>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
</local:TextBoxWithButton>
|
||||
@@ -518,6 +520,7 @@
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="60"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Grid.Column="0"
|
||||
Command="{Binding NavigationHelper.GoBackCommand, ElementName=PageRoot}"
|
||||
@@ -552,20 +555,48 @@
|
||||
</TextBox>
|
||||
<userControls:BreadCrumbUserControl ItemsSource="{Binding BreadCrumb}" Margin="5,-5,0,0" />
|
||||
</StackPanel>
|
||||
<userControls:TopMenuUserControl
|
||||
x:Name="TopMenu" Grid.Column="2"
|
||||
RestoreButtonVisibility="{Binding ParentGroup.IsSelected, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
DeleteButtonVisibility="{Binding IsSelected, Converter={StaticResource InverseBooleanToVisibilityConverter}}"
|
||||
IsEditButtonChecked="{Binding IsEditMode, Mode=TwoWay}"
|
||||
SaveCommand="{Binding SaveCommand}"
|
||||
RestoreCommand="{Binding UndoDeleteCommand}">
|
||||
<interactivity:Interaction.Behaviors>
|
||||
<core:EventTriggerBehavior EventName="DeleteButtonClick">
|
||||
<actions:DeleteEntityAction Entity="{Binding}" Command="{Binding NavigationHelper.GoBackCommand, ElementName=PageRoot}" />
|
||||
</core:EventTriggerBehavior>
|
||||
<core:EventTriggerBehavior EventName="RestoreButtonClick">
|
||||
<actions:RestoreEntityAction Entity="{Binding}" Command="{Binding NavigationHelper.GoBackCommand, ElementName=PageRoot}" />
|
||||
</core:EventTriggerBehavior>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
</userControls:TopMenuUserControl>
|
||||
</Grid>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup>
|
||||
<VisualState x:Name="Small">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpirationDatePanel" Storyboard.TargetProperty="Orientation">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="Vertical"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TopMenu" Storyboard.TargetProperty="OverflowButtonsVisibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TopMenu" Storyboard.TargetProperty="MoreButtonVisibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Large">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpirationDatePanel" Storyboard.TargetProperty="Orientation">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="Horizontal"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Small">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpirationDatePanel" Storyboard.TargetProperty="Orientation">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="Vertical"/>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TopMenu" Storyboard.TargetProperty="OverflowButtonsVisibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TopMenu" Storyboard.TargetProperty="MoreButtonVisibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
|
@@ -280,10 +280,13 @@
|
||||
<userControls:TopMenuUserControl x:Name="TopMenu" Grid.Column="2"
|
||||
RestoreButtonVisibility="{Binding ShowRestore, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
DeleteButtonVisibility="{Binding IsSelected, Converter={StaticResource InverseBooleanToVisibilityConverter}}"
|
||||
SortButtonVisibility="{Binding IsEditMode, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
IsEditButtonChecked="{Binding IsEditMode, Mode=TwoWay}"
|
||||
IsDeleteButtonEnabled="{Binding IsNotRoot}"
|
||||
SaveCommand="{Binding SaveCommand}"
|
||||
RestoreCommand="{Binding UndoDeleteCommand}">
|
||||
RestoreCommand="{Binding UndoDeleteCommand}"
|
||||
SortEntriesCommand="{Binding SortEntriesCommand}"
|
||||
SortGroupsCommand="{Binding SortGroupsCommand}">
|
||||
<interactivity:Interaction.Behaviors>
|
||||
<core:EventTriggerBehavior EventName="DeleteButtonClick">
|
||||
<actions:DeleteEntityAction Entity="{Binding}" Command="{Binding NavigationHelper.GoBackCommand, ElementName=PageRoot}" />
|
||||
|
@@ -7,7 +7,7 @@
|
||||
mc:Ignorable="d">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel Orientation="Horizontal" Visibility="{Binding OverflowButtonsVisibility, ElementName=UserControl}">
|
||||
<Button Command="{Binding RestoreCommand, ElementName=UserControl}" Visibility="{Binding RestoreButtonVisibility, ElementName=UserControl}" Click="RestoreButton_Click" Style="{StaticResource NoBorderButtonStyle}" Height="50">
|
||||
<Button Command="{Binding RestoreCommand, ElementName=UserControl}" Visibility="{Binding RestoreButtonVisibility, ElementName=UserControl}" IsEnabled="{Binding IsRestoreButtonEnabled,ElementName=UserControl}" Click="RestoreButton_Click" Style="{StaticResource NoBorderButtonStyle}" Height="50">
|
||||
<SymbolIcon Symbol="Undo">
|
||||
<ToolTipService.ToolTip>
|
||||
<ToolTip x:Uid="TopMenuRestoreButton" />
|
||||
@@ -28,6 +28,19 @@
|
||||
</ToolTipService.ToolTip>
|
||||
</SymbolIcon>
|
||||
</ToggleButton>
|
||||
<Button Visibility="{Binding SortButtonVisibility, ElementName=UserControl}" Style="{StaticResource NoBorderButtonStyle}" Height="50">
|
||||
<SymbolIcon Symbol="Sort">
|
||||
<ToolTipService.ToolTip>
|
||||
<ToolTip x:Uid="TopMenuSortButton" />
|
||||
</ToolTipService.ToolTip>
|
||||
</SymbolIcon>
|
||||
<Button.Flyout>
|
||||
<MenuFlyout>
|
||||
<MenuFlyoutItem x:Uid="AppBarSortEntries" Command="{Binding SortEntriesCommand, ElementName=UserControl}" />
|
||||
<MenuFlyoutItem x:Uid="AppBarSortGroups" Command="{Binding SortGroupsCommand, ElementName=UserControl}" />
|
||||
</MenuFlyout>
|
||||
</Button.Flyout>
|
||||
</Button>
|
||||
<Button Command="{Binding DeleteCommand, ElementName=UserControl}" IsEnabled="{Binding IsDeleteButtonEnabled, ElementName=UserControl}" Visibility="{Binding DeleteButtonVisibility, ElementName=UserControl}" Click="DeleteButton_Click" Style="{StaticResource NoBorderButtonStyle}" Height="50">
|
||||
<SymbolIcon Symbol="Delete">
|
||||
<ToolTipService.ToolTip>
|
||||
@@ -40,10 +53,12 @@
|
||||
<SymbolIcon Symbol="More" />
|
||||
<Button.Flyout>
|
||||
<MenuFlyout Opening="FlyoutBase_OnOpening">
|
||||
<MenuFlyoutItem x:Uid="TopMenuRestoreFlyout" x:Name="RestoreFlyout" Command="{Binding RestoreCommand, ElementName=UserControl}" Click="RestoreButton_Click" Visibility="{Binding RestoreButtonVisibility, ElementName=UserControl}" />
|
||||
<MenuFlyoutItem x:Uid="TopMenuRestoreFlyout" x:Name="RestoreFlyout" Command="{Binding RestoreCommand, ElementName=UserControl}" IsEnabled="{Binding IsRestoreButtonEnabled,ElementName=UserControl}" Click="RestoreButton_Click" Visibility="{Binding RestoreButtonVisibility, ElementName=UserControl}" />
|
||||
<MenuFlyoutItem x:Uid="TopMenuSaveFlyout" Command="{Binding SaveCommand, ElementName=UserControl}" />
|
||||
<ToggleMenuFlyoutItem x:Uid="TopMenuEditFlyout" x:Name="EditFlyout" Command="{Binding EditCommand, ElementName=UserControl}" IsChecked="{Binding IsEditButtonChecked, ElementName=UserControl, Mode=TwoWay}" Click="EditButton_Click" />
|
||||
<MenuFlyoutItem x:Uid="TopMenuDeleteFlyout" x:Name="DeleteFlyout" Command="{Binding DeleteCommand, ElementName=UserControl}" Click="DeleteButton_Click" Visibility="{Binding DeleteButtonVisibility, ElementName=UserControl}" IsEnabled="{Binding IsDeleteButtonEnabled, ElementName=UserControl}" />
|
||||
<MenuFlyoutItem x:Uid="AppBarSortEntries" x:Name="SortEntriesFlyout" Command="{Binding SortEntriesCommand, ElementName=UserControl}" Visibility="{Binding SortButtonVisibility, ElementName=UserControl}" />
|
||||
<MenuFlyoutItem x:Uid="AppBarSortGroups" x:Name="SortGroupsFlyout" Command="{Binding SortGroupsCommand, ElementName=UserControl}" Visibility="{Binding SortButtonVisibility, ElementName=UserControl}" />
|
||||
</MenuFlyout>
|
||||
</Button.Flyout>
|
||||
</Button>
|
||||
|
@@ -54,7 +54,31 @@ namespace ModernKeePass.Views.UserControls
|
||||
typeof(ICommand),
|
||||
typeof(TopMenuUserControl),
|
||||
new PropertyMetadata(null, (o, args) => { }));
|
||||
|
||||
public ICommand SortEntriesCommand
|
||||
{
|
||||
get { return (ICommand)GetValue(SortEntriesCommandProperty); }
|
||||
set { SetValue(SortEntriesCommandProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty SortEntriesCommandProperty =
|
||||
DependencyProperty.Register(
|
||||
"SortEntriesCommand",
|
||||
typeof(ICommand),
|
||||
typeof(TopMenuUserControl),
|
||||
new PropertyMetadata(null, (o, args) => { }));
|
||||
|
||||
public ICommand SortGroupsCommand
|
||||
{
|
||||
get { return (ICommand)GetValue(SortGroupsCommandProperty); }
|
||||
set { SetValue(SortGroupsCommandProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty SortGroupsCommandProperty =
|
||||
DependencyProperty.Register(
|
||||
"SortGroupsCommand",
|
||||
typeof(ICommand),
|
||||
typeof(TopMenuUserControl),
|
||||
new PropertyMetadata(null, (o, args) => { }));
|
||||
|
||||
public Visibility RestoreButtonVisibility
|
||||
{
|
||||
get { return (Visibility)GetValue(RestoreButtonVisibilityProperty); }
|
||||
@@ -65,7 +89,7 @@ namespace ModernKeePass.Views.UserControls
|
||||
"RestoreButtonVisibility",
|
||||
typeof(Visibility),
|
||||
typeof(TopMenuUserControl),
|
||||
new PropertyMetadata(false, (o, args) => { }));
|
||||
new PropertyMetadata(Visibility.Collapsed, (o, args) => { }));
|
||||
|
||||
public Visibility DeleteButtonVisibility
|
||||
{
|
||||
@@ -77,7 +101,7 @@ namespace ModernKeePass.Views.UserControls
|
||||
"DeleteButtonVisibility",
|
||||
typeof(Visibility),
|
||||
typeof(TopMenuUserControl),
|
||||
new PropertyMetadata(false, (o, args) => { }));
|
||||
new PropertyMetadata(Visibility.Collapsed, (o, args) => { }));
|
||||
|
||||
public Visibility MoreButtonVisibility
|
||||
{
|
||||
@@ -89,7 +113,7 @@ namespace ModernKeePass.Views.UserControls
|
||||
"MoreButtonVisibility",
|
||||
typeof(Visibility),
|
||||
typeof(TopMenuUserControl),
|
||||
new PropertyMetadata(false, (o, args) => { }));
|
||||
new PropertyMetadata(Visibility.Collapsed, (o, args) => { }));
|
||||
|
||||
public Visibility OverflowButtonsVisibility
|
||||
{
|
||||
@@ -101,7 +125,19 @@ namespace ModernKeePass.Views.UserControls
|
||||
"OverflowButtonsVisibility",
|
||||
typeof(Visibility),
|
||||
typeof(TopMenuUserControl),
|
||||
new PropertyMetadata(false, (o, args) => { }));
|
||||
new PropertyMetadata(Visibility.Collapsed, (o, args) => { }));
|
||||
|
||||
public Visibility SortButtonVisibility
|
||||
{
|
||||
get { return (Visibility)GetValue(SortButtonVisibilityProperty); }
|
||||
set { SetValue(SortButtonVisibilityProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty SortButtonVisibilityProperty =
|
||||
DependencyProperty.Register(
|
||||
"SortButtonVisibility",
|
||||
typeof(Visibility),
|
||||
typeof(TopMenuUserControl),
|
||||
new PropertyMetadata(Visibility.Collapsed, (o, args) => { }));
|
||||
|
||||
public bool IsDeleteButtonEnabled
|
||||
{
|
||||
@@ -126,6 +162,18 @@ namespace ModernKeePass.Views.UserControls
|
||||
typeof(bool),
|
||||
typeof(TopMenuUserControl),
|
||||
new PropertyMetadata(false, (o, args) => { }));
|
||||
|
||||
public bool IsRestoreButtonEnabled
|
||||
{
|
||||
get { return (bool)GetValue(IsRestoreButtonEnabledProperty); }
|
||||
set { SetValue(IsRestoreButtonEnabledProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty IsRestoreButtonEnabledProperty =
|
||||
DependencyProperty.Register(
|
||||
"IsRestoreButtonEnabled",
|
||||
typeof(bool),
|
||||
typeof(TopMenuUserControl),
|
||||
new PropertyMetadata(false, (o, args) => { }));
|
||||
|
||||
public event EditButtonClickEventHandler EditButtonClick;
|
||||
public delegate void EditButtonClickEventHandler(object sender, RoutedEventArgs e);
|
||||
@@ -137,6 +185,13 @@ namespace ModernKeePass.Views.UserControls
|
||||
public TopMenuUserControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
EditFlyout.Click += EditFlyout_Click;
|
||||
}
|
||||
|
||||
private void EditFlyout_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
IsEditButtonChecked = EditFlyout.IsChecked;
|
||||
EditButton_Click(sender, e);
|
||||
}
|
||||
|
||||
private void EditButton_Click(object sender, RoutedEventArgs e)
|
||||
@@ -161,7 +216,11 @@ namespace ModernKeePass.Views.UserControls
|
||||
|
||||
EditFlyout.IsChecked = IsEditButtonChecked;
|
||||
|
||||
RestoreFlyout.IsEnabled = IsRestoreButtonEnabled;
|
||||
RestoreFlyout.Visibility = RestoreButtonVisibility;
|
||||
|
||||
SortEntriesFlyout.Visibility = SortButtonVisibility;
|
||||
SortGroupsFlyout.Visibility = SortButtonVisibility;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user