mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
New Save button in the AppBar EntryPage now uses the same AppBar as GroupPage (but not shared...) Some new Symbol mappings
278 lines
18 KiB
XML
278 lines
18 KiB
XML
<Page
|
|
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:viewModels="using:ModernKeePass.ViewModels"
|
|
xmlns:converters="using:ModernKeePass.Converters"
|
|
xmlns:local="using:ModernKeePass.Controls"
|
|
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
|
|
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
|
|
xmlns:actions="using:ModernKeePass.Actions"
|
|
x:Name="PageRoot"
|
|
x:Class="ModernKeePass.Pages.GroupDetailPage"
|
|
mc:Ignorable="d" >
|
|
<Page.Resources>
|
|
<SolidColorBrush x:Key="Transparent" Color="Transparent"/>
|
|
<SolidColorBrush x:Key="SystemColor" Color="{StaticResource SystemColorButtonFaceColor}" />
|
|
<converters:ColorToBrushConverter x:Key="ColorToBrushConverter"/>
|
|
<converters:TextToFontStyleConverter x:Key="TextToFontStyleConverter"/>
|
|
</Page.Resources>
|
|
<Page.DataContext>
|
|
<viewModels:GroupVm />
|
|
</Page.DataContext>
|
|
<Page.BottomAppBar>
|
|
<CommandBar x:Name="CommandBar" VerticalAlignment="Center">
|
|
<CommandBar.SecondaryCommands>
|
|
<AppBarButton Icon="Save" Label="Save">
|
|
<interactivity:Interaction.Behaviors>
|
|
<core:EventTriggerBehavior EventName="Click">
|
|
<core:CallMethodAction TargetObject="{Binding}" MethodName="Save"/>
|
|
<core:ChangePropertyAction TargetObject="{Binding ElementName=CommandBar}" PropertyName="IsOpen" Value="False" />
|
|
</core:EventTriggerBehavior>
|
|
</interactivity:Interaction.Behaviors>
|
|
</AppBarButton>
|
|
<AppBarButton Icon="Setting" Label="Settings" />
|
|
</CommandBar.SecondaryCommands>
|
|
<AppBarToggleButton Icon="Edit" Label="Edit" IsChecked="{Binding IsEditMode, Mode=TwoWay}">
|
|
<interactivity:Interaction.Behaviors>
|
|
<core:EventTriggerBehavior EventName="Click">
|
|
<core:ChangePropertyAction TargetObject="{Binding ElementName=CommandBar}" PropertyName="IsOpen" Value="False" />
|
|
</core:EventTriggerBehavior>
|
|
</interactivity:Interaction.Behaviors>
|
|
</AppBarToggleButton>
|
|
<AppBarButton Icon="Delete" Label="Delete" IsEnabled="{Binding IsNotRoot}" Click="DeleteButton_Click" />
|
|
</CommandBar>
|
|
</Page.BottomAppBar>
|
|
<Grid>
|
|
<Grid.Resources>
|
|
<CollectionViewSource
|
|
x:Name="GroupsViewSource"
|
|
Source="{Binding Groups}" />
|
|
<CollectionViewSource
|
|
x:Name="EntriesViewSource"
|
|
Source="{Binding Entries}" />
|
|
<CollectionViewSource
|
|
x:Name="EntriesZoomedOutViewSource"
|
|
Source="{Binding EntriesZoomedOut}" IsSourceGrouped="True"/>
|
|
</Grid.Resources>
|
|
<Grid.Background>
|
|
<StaticResource ResourceKey="ApplicationPageBackgroundThemeBrush"/>
|
|
</Grid.Background>
|
|
<Grid.ChildrenTransitions>
|
|
<TransitionCollection>
|
|
<EntranceThemeTransition/>
|
|
</TransitionCollection>
|
|
</Grid.ChildrenTransitions>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="140"/>
|
|
<RowDefinition Height="*"/>
|
|
</Grid.RowDefinitions>
|
|
<!-- Horizontal scrolling grid -->
|
|
<SemanticZoom Grid.Row="1" ViewChangeStarted="SemanticZoom_ViewChangeStarted" >
|
|
<SemanticZoom.ZoomedInView>
|
|
<GridView
|
|
x:Name="GridView"
|
|
AutomationProperties.AutomationId="ItemGridView"
|
|
AutomationProperties.Name="Entries"
|
|
TabIndex="1"
|
|
IsSwipeEnabled="false"
|
|
SelectionChanged="entries_SelectionChanged"
|
|
IsSynchronizedWithCurrentItem="False">
|
|
<interactivity:Interaction.Behaviors>
|
|
<core:DataTriggerBehavior Binding="{Binding IsEditMode}" Value="False">
|
|
<actions:SetupFocusAction TargetObject="{Binding ElementName=GridView}" />
|
|
</core:DataTriggerBehavior>
|
|
</interactivity:Interaction.Behaviors>
|
|
<GridView.Resources>
|
|
<DataTemplate x:Name="GroupFirstItem">
|
|
<Border
|
|
BorderThickness="2"
|
|
BorderBrush="{StaticResource SystemColor}"
|
|
Background="{StaticResource HubSectionHeaderPressedForegroundThemeBrush}">
|
|
<Grid Height="110" Width="480">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
<SymbolIcon Grid.Column="0" Symbol="{Binding IconSymbol}" Width="100" Height="100" RenderTransformOrigin="0.5,0.5" >
|
|
<SymbolIcon.RenderTransform>
|
|
<CompositeTransform ScaleX="2" TranslateX="0" TranslateY="0" ScaleY="2"/>
|
|
</SymbolIcon.RenderTransform>
|
|
</SymbolIcon>
|
|
<TextBlock Grid.Column="1" Text="{Binding Name}" FontWeight="Bold" Style="{ThemeResource TitleTextBlockStyle}" TextWrapping="NoWrap" VerticalAlignment="Center" Margin="13,0,0,5"/>
|
|
</Grid>
|
|
</Border>
|
|
</DataTemplate>
|
|
<DataTemplate x:Name="GroupOtherItem">
|
|
<Grid Height="110" Width="480" x:Name="EntryGrid" >
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
<Border
|
|
Grid.Column="0"
|
|
BorderThickness="2"
|
|
BorderBrush="{StaticResource SystemColor}"
|
|
Background="{Binding BackgroundColor, ConverterParameter={StaticResource Transparent}, Converter={StaticResource ColorToBrushConverter}}">
|
|
<SymbolIcon Symbol="{Binding IconSymbol}" Width="100" Height="100" RenderTransformOrigin="0.5,0.5" >
|
|
<SymbolIcon.RenderTransform>
|
|
<CompositeTransform ScaleX="2" TranslateX="0" TranslateY="0" ScaleY="2"/>
|
|
</SymbolIcon.RenderTransform>
|
|
</SymbolIcon>
|
|
</Border>
|
|
<StackPanel Grid.Column="1" VerticalAlignment="Top" Margin="10,10,0,0" >
|
|
<TextBlock x:Name="NameTextBlock" Text="{Binding Name}" Style="{StaticResource TitleTextBlockStyle}" TextWrapping="NoWrap" Foreground="{Binding ForegroundColor, ConverterParameter={StaticResource TextBoxForegroundThemeBrush}, Converter={StaticResource ColorToBrushConverter}}"/>
|
|
<!--<Line Visibility="{Binding HasExpired, Converter={StaticResource BooleanToVisibilityConverter}}" Margin="0,-10,0,0" Stretch="Fill" Stroke="{Binding ForegroundColor, ConverterParameter={StaticResource TextBoxForegroundThemeBrush}, Converter={StaticResource ColorToBrushConverter}}" StrokeThickness="1" X1="1" Width="{Binding Name, Converter={StaticResource TextToWidthConverter}, ConverterParameter=7}" HorizontalAlignment="Left" VerticalAlignment="Center" />-->
|
|
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" TextWrapping="NoWrap"/>
|
|
<!--<TextBlock Text="{Binding EntryCount, ConverterParameter=entry\,entries, Converter={StaticResource PluralizationConverter}}" Style="{StaticResource BodyTextBlockStyle}" MaxHeight="60" />
|
|
<TextBlock Text="{Binding GroupCount, ConverterParameter=group\,groups, Converter={StaticResource PluralizationConverter}}" Style="{StaticResource BodyTextBlockStyle}" MaxHeight="60" />-->
|
|
<TextBlock Text="{Binding UserName}" Style="{StaticResource BodyTextBlockStyle}" MaxHeight="60" />
|
|
<TextBlock Text="{Binding Url}" Style="{StaticResource BodyTextBlockStyle}" MaxHeight="60" />
|
|
</StackPanel>
|
|
</Grid>
|
|
</DataTemplate>
|
|
</GridView.Resources>
|
|
<GridView.ItemsSource>
|
|
<Binding Source="{StaticResource EntriesViewSource}"/>
|
|
</GridView.ItemsSource>
|
|
<GridView.DataContext>
|
|
<viewModels:EntryVm/>
|
|
</GridView.DataContext>
|
|
<GridView.ItemTemplateSelector>
|
|
<local:FirstItemDataTemplateSelector
|
|
FirstItem="{StaticResource GroupFirstItem}"
|
|
OtherItem="{StaticResource GroupOtherItem}" />
|
|
</GridView.ItemTemplateSelector>
|
|
<GridView.ItemContainerStyle>
|
|
<Style TargetType="FrameworkElement">
|
|
<Setter Property="Margin" Value="52,0,0,2"/>
|
|
</Style>
|
|
</GridView.ItemContainerStyle>
|
|
<GridView.Header>
|
|
<ListView
|
|
x:Name="LeftListView"
|
|
SelectionChanged="groups_SelectionChanged"
|
|
IsSwipeEnabled="false"
|
|
IsSynchronizedWithCurrentItem="False"
|
|
DataContext="{Binding DataContext, ElementName=PageRoot}"
|
|
RequestedTheme="Dark"
|
|
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
|
Foreground="{ThemeResource DefaultTextForegroundThemeBrush}">
|
|
<ListView.Resources>
|
|
<DataTemplate x:Name="Collapsed">
|
|
<SymbolIcon Symbol="{Binding IconSymbol}">
|
|
<ToolTipService.ToolTip>
|
|
<ToolTip Content="{Binding Name}" />
|
|
</ToolTipService.ToolTip>
|
|
</SymbolIcon>
|
|
</DataTemplate>
|
|
<DataTemplate x:Name="Expanded">
|
|
<StackPanel Orientation="Horizontal">
|
|
<SymbolIcon Symbol="{Binding IconSymbol}" />
|
|
<TextBlock Text="{Binding Name}" FontWeight="{Binding FontWeight}" TextWrapping="NoWrap" VerticalAlignment="Center" Margin="30,0,20,0" FontStyle="{Binding Name, ConverterParameter=Recycle Bin, Converter={StaticResource TextToFontStyleConverter}}" />
|
|
<!--<TextBlock Text="{Binding EntryCount}" HorizontalAlignment="Right" VerticalAlignment="Center" />-->
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</ListView.Resources>
|
|
<ListView.ItemsSource>
|
|
<Binding Source="{StaticResource GroupsViewSource}"/>
|
|
</ListView.ItemsSource>
|
|
<ListView.ItemContainerStyle>
|
|
<Style TargetType="ListViewItem">
|
|
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
|
<Setter Property="Padding" Value="20,0,0,0"/>
|
|
<Setter Property="Margin" Value="0"/>
|
|
</Style>
|
|
</ListView.ItemContainerStyle>
|
|
<ListView.HeaderTemplate>
|
|
<DataTemplate>
|
|
<ToggleButton Style="{StaticResource HamburgerToggleButton}" Margin="0" >
|
|
<interactivity:Interaction.Behaviors>
|
|
<core:EventTriggerBehavior EventName="Loaded">
|
|
<core:ChangePropertyAction PropertyName="ItemTemplate" Value="{StaticResource Collapsed}" TargetObject="{Binding ElementName=LeftListView}"/>
|
|
</core:EventTriggerBehavior>
|
|
<core:EventTriggerBehavior EventName="Checked">
|
|
<core:ChangePropertyAction PropertyName="ItemTemplate" Value="{StaticResource Expanded}" TargetObject="{Binding ElementName=LeftListView}"/>
|
|
</core:EventTriggerBehavior>
|
|
<core:EventTriggerBehavior EventName="Unchecked">
|
|
<core:ChangePropertyAction PropertyName="ItemTemplate" Value="{StaticResource Collapsed}" TargetObject="{Binding ElementName=LeftListView}"/>
|
|
</core:EventTriggerBehavior>
|
|
</interactivity:Interaction.Behaviors>
|
|
</ToggleButton>
|
|
</DataTemplate>
|
|
</ListView.HeaderTemplate>
|
|
</ListView>
|
|
</GridView.Header>
|
|
</GridView>
|
|
</SemanticZoom.ZoomedInView>
|
|
|
|
<SemanticZoom.ZoomedOutView>
|
|
<ListView
|
|
x:Name="SemanticListView"
|
|
ItemsSource="{Binding Source={StaticResource EntriesZoomedOutViewSource}}"
|
|
IsSwipeEnabled="false"
|
|
SelectionChanged="groups_SelectionChanged"
|
|
IsSynchronizedWithCurrentItem="False">
|
|
<ListView.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<StackPanel Orientation="Horizontal" />
|
|
</ItemsPanelTemplate>
|
|
</ListView.ItemsPanel>
|
|
<ListView.ItemTemplate>
|
|
<DataTemplate>
|
|
<StackPanel Orientation="Vertical">
|
|
<TextBlock Text="{Binding Name}" Style="{StaticResource TitleTextBlockStyle}" TextWrapping="NoWrap"/>
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</ListView.ItemTemplate>
|
|
<ListView.GroupStyle>
|
|
<GroupStyle HidesIfEmpty="True">
|
|
<GroupStyle.HeaderTemplate>
|
|
<DataTemplate>
|
|
<Grid Background="LightGray" Margin="0,0,10,0" HorizontalAlignment="Left">
|
|
<TextBlock Text="{Binding Key}" Foreground="Black" Margin="30" Style="{StaticResource HeaderTextBlockStyle}"/>
|
|
</Grid>
|
|
</DataTemplate>
|
|
</GroupStyle.HeaderTemplate>
|
|
</GroupStyle>
|
|
</ListView.GroupStyle>
|
|
</ListView>
|
|
</SemanticZoom.ZoomedOutView>
|
|
</SemanticZoom>
|
|
|
|
<!-- Back button and page title -->
|
|
<Grid Grid.Row="0">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="120"/>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="400"/>
|
|
</Grid.ColumnDefinitions>
|
|
<Button Margin="39,0,39,0"
|
|
Command="{Binding NavigationHelper.GoBackCommand, ElementName=PageRoot}"
|
|
Style="{StaticResource NavigationBackButtonNormalStyle}"
|
|
VerticalAlignment="Center"
|
|
AutomationProperties.Name="Back"
|
|
AutomationProperties.AutomationId="BackButton"
|
|
AutomationProperties.ItemType="Navigation Button"/>
|
|
<TextBox
|
|
Grid.Column="1"
|
|
x:Name="TitleTextBox"
|
|
Text="{Binding Name, Mode=TwoWay}"
|
|
Style="{StaticResource HeaderTextBoxStyle}"
|
|
Foreground="{ThemeResource DefaultTextForegroundThemeBrush}"
|
|
IsHitTestVisible="{Binding IsEditMode}"
|
|
TextWrapping="NoWrap"
|
|
VerticalAlignment="Center"
|
|
Margin="0,0,30,5"
|
|
PlaceholderText="New group name...">
|
|
<interactivity:Interaction.Behaviors>
|
|
<core:DataTriggerBehavior Binding="{Binding IsEditMode}" Value="True">
|
|
<actions:SetupFocusAction TargetObject="{Binding ElementName=TitleTextBox}" />
|
|
</core:DataTriggerBehavior>
|
|
</interactivity:Interaction.Behaviors>
|
|
</TextBox>
|
|
<SearchBox Grid.Column="2" PlaceholderText="Search..." Width="350" Height="40" FontSize="18" SuggestionsRequested="SearchBox_OnSuggestionsRequested" SearchHistoryEnabled="False" ResultSuggestionChosen="SearchBox_OnResultSuggestionChosen" />
|
|
</Grid>
|
|
</Grid>
|
|
</Page> |