GroupDetailPage uses navigation service

This commit is contained in:
Geoffroy BONNEVILLE
2020-04-21 13:33:15 +02:00
parent c81f8bc835
commit ac66faa9e2
5 changed files with 70 additions and 46 deletions

View File

@@ -72,7 +72,15 @@
<DataTemplate>
<StackPanel Orientation="Vertical">
<Border BorderBrush="White" BorderThickness="0,0,0,1" />
<Button Padding="0" Height="{StaticResource MenuSize}" Margin="0" Visibility="{Binding IsButtonVisible, ElementName=UserControl}" Style="{StaticResource NoBorderButtonStyle}" Background="Transparent" BorderThickness="0" Width="{StaticResource ExpandedMenuSize}" HorizontalContentAlignment="Left" Click="ButtonBase_OnClick">
<Button Padding="0" Margin="0"
Height="{StaticResource MenuSize}"
Visibility="{Binding IsButtonVisible, ElementName=UserControl}"
Style="{StaticResource NoBorderButtonStyle}"
Background="Transparent"
BorderThickness="0"
Width="{StaticResource ExpandedMenuSize}"
HorizontalContentAlignment="Left"
Command="{Binding ActionButtonCommand, ElementName=UserControl}">
<StackPanel Orientation="Horizontal" Margin="17,0,5,0">
<SymbolIcon Symbol="Add">
<ToolTipService.ToolTip>

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using GalaSoft.MvvmLight.Command;
using ModernKeePass.Application.Common.Interfaces;
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
@@ -124,16 +125,23 @@ namespace ModernKeePass.Views.UserControls
typeof(HamburgerMenuUserControl),
new PropertyMetadata(false, (o, args) => { }));
public RelayCommand ActionButtonCommand
{
get { return (RelayCommand)GetValue(ActionButtonCommandProperty); }
set { SetValue(ActionButtonCommandProperty, value); }
}
public static readonly DependencyProperty ActionButtonCommandProperty =
DependencyProperty.Register(
nameof(ActionButtonCommand),
typeof(RelayCommand),
typeof(HamburgerMenuUserControl),
new PropertyMetadata(null, (o, args) => { }));
public event EventHandler<SelectionChangedEventArgs> SelectionChanged;
private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
SelectionChanged?.Invoke(sender, e);
}
public event EventHandler<RoutedEventArgs> ButtonClicked;
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
{
ButtonClicked?.Invoke(sender, e);
}
}
}