mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Hamburger menu button visibility is now a property
Hamburger menu now has a display member path property
This commit is contained in:
@@ -116,7 +116,7 @@
|
|||||||
<ColumnDefinition Width="50" x:Name="LeftListViewColumn" />
|
<ColumnDefinition Width="50" x:Name="LeftListViewColumn" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<userControls:HamburgerMenuUserControl x:Uid="GroupsLeftListView" ItemsSource="{Binding Groups}" SelectionChanged="groups_SelectionChanged" ButtonClicked="CreateGroup_ButtonClick" ResizeTarget="{Binding ElementName=LeftListViewColumn}" />
|
<userControls:HamburgerMenuUserControl x:Uid="GroupsLeftListView" ItemsSource="{Binding Groups}" DisplayMemberPath="Name" SelectionChanged="groups_SelectionChanged" ButtonClicked="CreateGroup_ButtonClick" ResizeTarget="{Binding ElementName=LeftListViewColumn}" IsButtonVisible="{Binding IsSelected}" />
|
||||||
<TextBlock Grid.Column="1" x:Uid="ReorderEntriesLabel" Margin="20,20,0,0" Visibility="{Binding IsEditMode, Converter={StaticResource BooleanToVisibilityConverter}}" Style="{StaticResource BodyTextBlockStyle}" />
|
<TextBlock Grid.Column="1" x:Uid="ReorderEntriesLabel" Margin="20,20,0,0" Visibility="{Binding IsEditMode, Converter={StaticResource BooleanToVisibilityConverter}}" Style="{StaticResource BodyTextBlockStyle}" />
|
||||||
<HyperlinkButton Grid.Column="1" VerticalAlignment="Top" Margin="40,10,0,0" Click="CreateEntry_ButtonClick" Visibility="{Binding IsSelected, Converter={StaticResource InverseBooleanToVisibilityConverter}}" HorizontalAlignment="Right" Foreground="{StaticResource MainColor}" Style="{StaticResource MainColorHyperlinkButton}">
|
<HyperlinkButton Grid.Column="1" VerticalAlignment="Top" Margin="40,10,0,0" Click="CreateEntry_ButtonClick" Visibility="{Binding IsSelected, Converter={StaticResource InverseBooleanToVisibilityConverter}}" HorizontalAlignment="Right" Foreground="{StaticResource MainColor}" Style="{StaticResource MainColorHyperlinkButton}">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
|
@@ -26,20 +26,20 @@
|
|||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<SymbolIcon Symbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}}" Margin="8,0,0,0">
|
<SymbolIcon Symbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}}" Margin="8,0,0,0">
|
||||||
<ToolTipService.ToolTip>
|
<ToolTipService.ToolTip>
|
||||||
<ToolTip Content="{Binding Name}" />
|
<ToolTip Content="{Binding Path={Binding DisplayMemberPath, ElementName=UserControl}}" />
|
||||||
</ToolTipService.ToolTip>
|
</ToolTipService.ToolTip>
|
||||||
</SymbolIcon>
|
</SymbolIcon>
|
||||||
<TextBlock Text="{Binding Name}" x:Name="GroupTextBlock" TextWrapping="NoWrap" VerticalAlignment="Center" Margin="30,0,20,0" FontStyle="Italic" />
|
<TextBlock Text="{Binding Path={Binding DisplayMemberPath, ElementName=UserControl}}" x:Name="GroupTextBlock" TextWrapping="NoWrap" VerticalAlignment="Center" Margin="30,0,20,0" FontStyle="Italic" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
<DataTemplate x:Name="IsNormal">
|
<DataTemplate x:Name="IsNormal">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<SymbolIcon Symbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}}" Margin="8,0,0,0">
|
<SymbolIcon Symbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}}" Margin="8,0,0,0">
|
||||||
<ToolTipService.ToolTip>
|
<ToolTipService.ToolTip>
|
||||||
<ToolTip Content="{Binding Name}" />
|
<ToolTip Content="{Binding Path={Binding DisplayMemberPath, ElementName=UserControl}}" />
|
||||||
</ToolTipService.ToolTip>
|
</ToolTipService.ToolTip>
|
||||||
</SymbolIcon>
|
</SymbolIcon>
|
||||||
<TextBlock Text="{Binding Name}" x:Name="GroupTextBlock" TextWrapping="NoWrap" VerticalAlignment="Center" Margin="30,0,20,0" />
|
<TextBlock Text="{Binding Path={Binding DisplayMemberPath, ElementName=UserControl}}" x:Name="GroupTextBlock" TextWrapping="NoWrap" VerticalAlignment="Center" Margin="30,0,20,0" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListView.Resources>
|
</ListView.Resources>
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
</ListView.HeaderTemplate>
|
</ListView.HeaderTemplate>
|
||||||
<ListView.FooterTemplate>
|
<ListView.FooterTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel Orientation="Vertical" Visibility="{Binding IsSelected, Converter={StaticResource InverseBooleanToVisibilityConverter}}">
|
<StackPanel Orientation="Vertical" Visibility="{Binding IsButtonVisible, ElementName=UserControl, Converter={StaticResource InverseBooleanToVisibilityConverter}}">
|
||||||
<Border BorderBrush="White" BorderThickness="0,0,0,1" />
|
<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" Style="{StaticResource NoBorderButtonStyle}" Background="Transparent" BorderThickness="0" Click="ButtonBase_OnClick">
|
||||||
<StackPanel Orientation="Horizontal" Margin="13,0,5,0">
|
<StackPanel Orientation="Horizontal" Margin="13,0,5,0">
|
||||||
|
@@ -7,7 +7,6 @@ using ModernKeePass.Interfaces;
|
|||||||
|
|
||||||
namespace ModernKeePass.Views.UserControls
|
namespace ModernKeePass.Views.UserControls
|
||||||
{
|
{
|
||||||
// TODO: Add a property (string path) that allows chosing which field to display
|
|
||||||
public sealed partial class HamburgerMenuUserControl
|
public sealed partial class HamburgerMenuUserControl
|
||||||
{
|
{
|
||||||
public HamburgerMenuUserControl()
|
public HamburgerMenuUserControl()
|
||||||
@@ -32,7 +31,6 @@ namespace ModernKeePass.Views.UserControls
|
|||||||
get { return (string)GetValue(ButtonLabelProperty); }
|
get { return (string)GetValue(ButtonLabelProperty); }
|
||||||
set { SetValue(ButtonLabelProperty, value); }
|
set { SetValue(ButtonLabelProperty, value); }
|
||||||
}
|
}
|
||||||
// TODO: set a boolean that will show/hide the button when a value is set/not set
|
|
||||||
public static readonly DependencyProperty ButtonLabelProperty =
|
public static readonly DependencyProperty ButtonLabelProperty =
|
||||||
DependencyProperty.Register(
|
DependencyProperty.Register(
|
||||||
"ButtonLabel",
|
"ButtonLabel",
|
||||||
@@ -40,6 +38,18 @@ namespace ModernKeePass.Views.UserControls
|
|||||||
typeof(HamburgerMenuUserControl),
|
typeof(HamburgerMenuUserControl),
|
||||||
new PropertyMetadata("Button", (o, args) => { }));
|
new PropertyMetadata("Button", (o, args) => { }));
|
||||||
|
|
||||||
|
public string DisplayMemberPath
|
||||||
|
{
|
||||||
|
get { return (string)GetValue(DisplayMemberPathProperty); }
|
||||||
|
set { SetValue(DisplayMemberPathProperty, value); }
|
||||||
|
}
|
||||||
|
public static readonly DependencyProperty DisplayMemberPathProperty =
|
||||||
|
DependencyProperty.Register(
|
||||||
|
"DisplayMemberPath",
|
||||||
|
typeof(string),
|
||||||
|
typeof(HamburgerMenuUserControl),
|
||||||
|
new PropertyMetadata("Name", (o, args) => { }));
|
||||||
|
|
||||||
public object ResizeTarget
|
public object ResizeTarget
|
||||||
{
|
{
|
||||||
get { return GetValue(ResizeTargetProperty); }
|
get { return GetValue(ResizeTargetProperty); }
|
||||||
@@ -52,6 +62,18 @@ namespace ModernKeePass.Views.UserControls
|
|||||||
typeof(HamburgerMenuUserControl),
|
typeof(HamburgerMenuUserControl),
|
||||||
new PropertyMetadata(null, (o, args) => { }));
|
new PropertyMetadata(null, (o, args) => { }));
|
||||||
|
|
||||||
|
public bool IsButtonVisible
|
||||||
|
{
|
||||||
|
get { return (bool)GetValue(IsButtonVisibleProperty); }
|
||||||
|
set { SetValue(IsButtonVisibleProperty, value); }
|
||||||
|
}
|
||||||
|
public static readonly DependencyProperty IsButtonVisibleProperty =
|
||||||
|
DependencyProperty.Register(
|
||||||
|
"IsButtonVisible",
|
||||||
|
typeof(bool),
|
||||||
|
typeof(HamburgerMenuUserControl),
|
||||||
|
new PropertyMetadata(false, (o, args) => { }));
|
||||||
|
|
||||||
public IEnumerable<IPwEntity> ItemsSource
|
public IEnumerable<IPwEntity> ItemsSource
|
||||||
{
|
{
|
||||||
get { return (IEnumerable<IPwEntity>)GetValue(ItemsSourceProperty); }
|
get { return (IEnumerable<IPwEntity>)GetValue(ItemsSourceProperty); }
|
||||||
|
Reference in New Issue
Block a user