mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
96 lines
6.0 KiB
XML
96 lines
6.0 KiB
XML
<UserControl x:Name="UserControl"
|
|
x:Class="ModernKeePass.Views.UserControls.HamburgerMenuUserControl"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:templateSelectors="using:ModernKeePass.TemplateSelectors"
|
|
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
|
|
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
|
|
xmlns:converters="using:ModernKeePass.Converters"
|
|
mc:Ignorable="d">
|
|
<UserControl.Resources>
|
|
<converters:InverseBooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter"/>
|
|
<converters:IntToSymbolConverter x:Key="IntToSymbolConverter"/>
|
|
</UserControl.Resources>
|
|
<ListView
|
|
ItemsSource="{Binding ItemsSource, ElementName=UserControl}"
|
|
SelectionChanged="Selector_OnSelectionChanged"
|
|
IsSwipeEnabled="false"
|
|
IsSynchronizedWithCurrentItem="False"
|
|
RequestedTheme="Dark"
|
|
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
|
Foreground="{ThemeResource DefaultTextForegroundThemeBrush}">
|
|
<ListView.Resources>
|
|
<DataTemplate x:Name="IsSpecial">
|
|
<StackPanel Orientation="Horizontal">
|
|
<SymbolIcon Symbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}}" Margin="8,0,0,0">
|
|
<ToolTipService.ToolTip>
|
|
<ToolTip Content="{Binding Path={Binding DisplayMemberPath, ElementName=UserControl}}" />
|
|
</ToolTipService.ToolTip>
|
|
</SymbolIcon>
|
|
<TextBlock Text="{Binding Path={Binding DisplayMemberPath, ElementName=UserControl}}" x:Name="GroupTextBlock" TextWrapping="NoWrap" VerticalAlignment="Center" Margin="30,0,20,0" FontStyle="Italic" />
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
<DataTemplate x:Name="IsNormal">
|
|
<StackPanel Orientation="Horizontal">
|
|
<SymbolIcon Symbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}}" Margin="8,0,0,0">
|
|
<ToolTipService.ToolTip>
|
|
<ToolTip Content="{Binding Path={Binding DisplayMemberPath, ElementName=UserControl}}" />
|
|
</ToolTipService.ToolTip>
|
|
</SymbolIcon>
|
|
<TextBlock Text="{Binding Path={Binding DisplayMemberPath, ElementName=UserControl}}" x:Name="GroupTextBlock" TextWrapping="NoWrap" VerticalAlignment="Center" Margin="30,0,20,0" />
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</ListView.Resources>
|
|
<ListView.ItemTemplateSelector>
|
|
<templateSelectors:SelectableDataTemplateSelector FalseItem="{StaticResource IsNormal}" TrueItem="{StaticResource IsSpecial}" />
|
|
</ListView.ItemTemplateSelector>
|
|
<ListView.ItemContainerStyle>
|
|
<Style TargetType="ListViewItem">
|
|
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
|
<Setter Property="Padding" Value="0"/>
|
|
<Setter Property="Margin" Value="0"/>
|
|
<Setter Property="AllowDrop" Value="True"/>
|
|
</Style>
|
|
</ListView.ItemContainerStyle>
|
|
<ListView.HeaderTemplate>
|
|
<DataTemplate>
|
|
<StackPanel Orientation="Horizontal">
|
|
<ToggleButton Style="{StaticResource HamburgerToggleButton}">
|
|
<ToolTipService.ToolTip>
|
|
<ToolTip Content="{Binding HeaderLabel, ElementName=UserControl}" />
|
|
</ToolTipService.ToolTip>
|
|
<interactivity:Interaction.Behaviors>
|
|
<core:EventTriggerBehavior EventName="Checked">
|
|
<core:ChangePropertyAction PropertyName="Width" Value="Auto" TargetObject="{Binding ResizeTarget, ElementName=UserControl}"/>
|
|
</core:EventTriggerBehavior>
|
|
<core:EventTriggerBehavior EventName="Unchecked">
|
|
<core:ChangePropertyAction PropertyName="Width" Value="50" TargetObject="{Binding ResizeTarget, ElementName=UserControl}"/>
|
|
</core:EventTriggerBehavior>
|
|
</interactivity:Interaction.Behaviors>
|
|
</ToggleButton>
|
|
<TextBlock Text="{Binding HeaderLabel, ElementName=UserControl}" FontWeight="Bold" FontSize="18" TextWrapping="NoWrap" VerticalAlignment="Center" Margin="30,0,20,0" HorizontalAlignment="Center" />
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</ListView.HeaderTemplate>
|
|
<ListView.FooterTemplate>
|
|
<DataTemplate>
|
|
<StackPanel Orientation="Vertical" Visibility="{Binding IsButtonVisible, ElementName=UserControl, Converter={StaticResource InverseBooleanToVisibilityConverter}}">
|
|
<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">
|
|
<StackPanel Orientation="Horizontal" Margin="13,0,5,0">
|
|
<SymbolIcon Symbol="Add">
|
|
<ToolTipService.ToolTip>
|
|
<ToolTip Content="{Binding ButtonLabel, ElementName=UserControl}" />
|
|
</ToolTipService.ToolTip>
|
|
</SymbolIcon>
|
|
<TextBlock Text="{Binding ButtonLabel, ElementName=UserControl}" FontWeight="SemiBold" TextWrapping="NoWrap" FontSize="16" VerticalAlignment="Center" Margin="30,0,20,0" />
|
|
</StackPanel>
|
|
</Button>
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</ListView.FooterTemplate>
|
|
</ListView>
|
|
</UserControl>
|