mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
WIP Breadcrumb
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
<ResourceDictionary Source="Styles/HamburgerButtonStyle.xaml" />
|
||||
<ResourceDictionary Source="Styles/ListViewLeftIndicatorStyle.xaml" />
|
||||
<ResourceDictionary Source="Styles/NoBorderButtonStyle.xaml" />
|
||||
<ResourceDictionary Source="Styles/BreadcrumbStyle.xaml" />
|
||||
<ResourceDictionary Source="Styles/Styles.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
|
55
ModernKeePass/Controls/Breadcrumb.cs
Normal file
55
ModernKeePass/Controls/Breadcrumb.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System.Collections.Generic;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using ModernKeePass.Interfaces;
|
||||
|
||||
// The Templated Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234235
|
||||
|
||||
namespace ModernKeePass.Controls
|
||||
{
|
||||
public class Breadcrumb : Control
|
||||
{
|
||||
public Breadcrumb()
|
||||
{
|
||||
DefaultStyleKey = typeof(Breadcrumb);
|
||||
}
|
||||
public string TargetPage
|
||||
{
|
||||
get { return (string)GetValue(TargetPageProperty); }
|
||||
set { SetValue(TargetPageProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty TargetPageProperty =
|
||||
DependencyProperty.Register(
|
||||
"TargetPage",
|
||||
typeof(string),
|
||||
typeof(Breadcrumb),
|
||||
new PropertyMetadata(string.Empty, (o, args) => { }));
|
||||
|
||||
public Symbol SeparatorSymbol
|
||||
{
|
||||
get { return (Symbol)GetValue(SeparatorSymbolProperty); }
|
||||
set { SetValue(SeparatorSymbolProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SeparatorSymbolProperty =
|
||||
DependencyProperty.Register(
|
||||
"SeparatorSymbol",
|
||||
typeof(Symbol),
|
||||
typeof(Breadcrumb),
|
||||
new PropertyMetadata(Symbol.Forward, (o, args) => { }));
|
||||
|
||||
public IEnumerable<IPwEntity> PathItems
|
||||
{
|
||||
get { return (IEnumerable<IPwEntity>)GetValue(PathItemsProperty); }
|
||||
set { SetValue(PathItemsProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty PathItemsProperty =
|
||||
DependencyProperty.Register(
|
||||
"PathItems",
|
||||
typeof(IEnumerable<>),
|
||||
typeof(Breadcrumb),
|
||||
new PropertyMetadata(null, (o, args) => { }));
|
||||
}
|
||||
}
|
@@ -114,6 +114,7 @@
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\Breadcrumb.cs" />
|
||||
<Compile Include="Exceptions\DatabaseOpenedException.cs" />
|
||||
<Compile Include="Interfaces\ILicenseService.cs" />
|
||||
<Compile Include="Interfaces\IProxyInvocationHandler.cs" />
|
||||
@@ -247,6 +248,11 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="Styles\BreadcrumbStyle.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Page>
|
||||
<Page Include="Styles\Colors.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Storage;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Microsoft.HockeyApp;
|
||||
using ModernKeePass.Exceptions;
|
||||
using ModernKeePass.Interfaces;
|
||||
using ModernKeePass.ViewModels;
|
||||
@@ -146,6 +147,7 @@ namespace ModernKeePass.Services
|
||||
}
|
||||
catch (InvalidCompositeKeyException ex)
|
||||
{
|
||||
HockeyClient.Current.TrackException(ex);
|
||||
throw new ArgumentException(ex.Message, ex);
|
||||
}
|
||||
}
|
||||
|
58
ModernKeePass/Styles/BreadcrumbStyle.xaml
Normal file
58
ModernKeePass/Styles/BreadcrumbStyle.xaml
Normal file
@@ -0,0 +1,58 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:ModernKeePass.Controls"
|
||||
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
|
||||
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
|
||||
xmlns:templateSelectors="using:ModernKeePass.TemplateSelectors">
|
||||
<Style TargetType="controls:Breadcrumb">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:Breadcrumb">
|
||||
<ItemsControl ItemsSource="{TemplateBinding PathItems}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<VirtualizingStackPanel Orientation="Horizontal"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.Resources>
|
||||
<DataTemplate x:Name="FirstItemTemplate">
|
||||
<TextBlock>
|
||||
<Hyperlink Foreground="{StaticResource MainColor}">
|
||||
<Run Text="{Binding Name}" />
|
||||
<interactivity:Interaction.Behaviors>
|
||||
<core:EventTriggerBehavior EventName="Click" >
|
||||
<core:NavigateToPageAction Parameter="{Binding}" TargetPage="{TemplateBinding TargetPage}" />
|
||||
</core:EventTriggerBehavior>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Name="OtherItemsTemplate">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Viewbox MaxHeight="12" >
|
||||
<SymbolIcon Symbol="{TemplateBinding SeparatorSymbol}" />
|
||||
</Viewbox>
|
||||
<TextBlock>
|
||||
<Hyperlink Foreground="{StaticResource MainColor}">
|
||||
<Run Text="{Binding Name}" />
|
||||
<interactivity:Interaction.Behaviors>
|
||||
<core:EventTriggerBehavior EventName="Click" >
|
||||
<core:NavigateToPageAction Parameter="{Binding}" TargetPage="{TemplateBinding TargetPage}" />
|
||||
</core:EventTriggerBehavior>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.Resources>
|
||||
<ItemsControl.ItemTemplateSelector>
|
||||
<templateSelectors:FirstItemDataTemplateSelector FirstItem="{StaticResource FirstItemTemplate}" OtherItem="{StaticResource OtherItemsTemplate}"/>
|
||||
</ItemsControl.ItemTemplateSelector>
|
||||
</ItemsControl>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
|
@@ -143,6 +143,7 @@ namespace ModernKeePass.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
public string Path
|
||||
{
|
||||
get
|
||||
|
@@ -93,22 +93,23 @@ namespace ModernKeePass.ViewModels
|
||||
set { SetProperty(ref _isMenuClosed, value); }
|
||||
}
|
||||
|
||||
public ObservableCollection<GroupVm> BreadCrumb
|
||||
public Stack<GroupVm> BreadCrumb
|
||||
{
|
||||
get
|
||||
{
|
||||
var groups = new ObservableCollection<GroupVm>();
|
||||
var groups = new Stack<GroupVm>();
|
||||
var group = this;
|
||||
while (group.ParentGroup != null)
|
||||
{
|
||||
group = group.ParentGroup;
|
||||
groups.Insert(0, group);
|
||||
groups.Push(group);
|
||||
}
|
||||
|
||||
return groups;
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
public string Path
|
||||
{
|
||||
get
|
||||
|
@@ -9,6 +9,7 @@
|
||||
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
|
||||
xmlns:actions="using:ModernKeePass.Actions"
|
||||
xmlns:templateSelectors="using:ModernKeePass.TemplateSelectors"
|
||||
xmlns:controls="using:ModernKeePass.Controls"
|
||||
x:Name="PageRoot"
|
||||
x:Class="ModernKeePass.Views.GroupDetailPage"
|
||||
mc:Ignorable="d"
|
||||
@@ -95,7 +96,10 @@
|
||||
Source="{Binding Entries}" />
|
||||
<CollectionViewSource
|
||||
x:Name="EntriesZoomedOutViewSource"
|
||||
Source="{Binding EntriesZoomedOut}" IsSourceGrouped="True"/>
|
||||
Source="{Binding EntriesZoomedOut}" IsSourceGrouped="True" />
|
||||
<CollectionViewSource
|
||||
x:Name="BreadCrumbViewSource"
|
||||
Source="{Binding BreadCrumb}" />
|
||||
</Grid.Resources>
|
||||
<Grid.Background>
|
||||
<StaticResource ResourceKey="ApplicationPageBackgroundThemeBrush"/>
|
||||
@@ -210,6 +214,7 @@
|
||||
<!-- Horizontal scrolling grid -->
|
||||
<GridView
|
||||
x:Name="GridView"
|
||||
ItemsSource="{Binding Source={StaticResource EntriesViewSource}}"
|
||||
AutomationProperties.AutomationId="ItemGridView"
|
||||
AutomationProperties.Name="Entries"
|
||||
TabIndex="1"
|
||||
@@ -275,12 +280,6 @@
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</GridView.ItemTemplate>
|
||||
<GridView.ItemsSource>
|
||||
<Binding Source="{StaticResource EntriesViewSource}"/>
|
||||
</GridView.ItemsSource>
|
||||
<GridView.DataContext>
|
||||
<viewModels:EntryVm/>
|
||||
</GridView.DataContext>
|
||||
</GridView>
|
||||
</SemanticZoom.ZoomedInView>
|
||||
<SemanticZoom.ZoomedOutView>
|
||||
@@ -347,7 +346,8 @@
|
||||
</core:DataTriggerBehavior>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
</TextBox>
|
||||
<TextBlock FontSize="12" Text="{Binding Path}" />
|
||||
<!--<TextBlock FontSize="12" Text="{Binding Path}" />-->
|
||||
<controls:Breadcrumb PathItems="{Binding Source={StaticResource BreadCrumbViewSource}}" TargetPage="ModernKeePass.Views.GroupDetailPage" />
|
||||
</StackPanel>
|
||||
<Button Grid.Column="2" x:Name="SearchButton" Style="{StaticResource NoBorderButtonStyle}" Height="50">
|
||||
<SymbolIcon Symbol="Find" />
|
||||
|
@@ -24,7 +24,8 @@
|
||||
<Run x:Uid="AboutHomepage" />
|
||||
<Hyperlink NavigateUri="https://github.com/wismna/ModernKeePass" Foreground="{StaticResource MainColor}">
|
||||
<Run Text="https://github.com/wismna/ModernKeePass"/>
|
||||
</Hyperlink></TextBlock>
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Margin="10,0,0,0">
|
||||
<Run x:Uid="AboutCreditsLabel" />
|
||||
</TextBlock>
|
||||
|
Reference in New Issue
Block a user