mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-04 08:00:16 -04:00
Backgrounds unified Menu items can be disabled thanks to custom ListView control
90 lines
3.3 KiB
C#
90 lines
3.3 KiB
C#
using System;
|
|
using ModernKeePass.Common;
|
|
using Windows.UI.Xaml.Controls;
|
|
using Windows.UI.Xaml.Navigation;
|
|
using ModernKeePass.ViewModels;
|
|
|
|
// The Group Detail Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234229
|
|
|
|
namespace ModernKeePass.Pages
|
|
{
|
|
/// <summary>
|
|
/// A page that displays an overview of a single group, including a preview of the items
|
|
/// within the group.
|
|
/// </summary>
|
|
public sealed partial class GroupDetailPage : Page
|
|
{
|
|
private NavigationHelper navigationHelper;
|
|
|
|
/// <summary>
|
|
/// NavigationHelper is used on each page to aid in navigation and
|
|
/// process lifetime management
|
|
/// </summary>
|
|
public NavigationHelper NavigationHelper => navigationHelper;
|
|
|
|
|
|
public GroupDetailPage()
|
|
{
|
|
InitializeComponent();
|
|
navigationHelper = new NavigationHelper(this);
|
|
navigationHelper.LoadState += navigationHelper_LoadState;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Populates the page with content passed during navigation. Any saved state is also
|
|
/// provided when recreating a page from a prior session.
|
|
/// </summary>
|
|
/// <param name="sender">
|
|
/// The source of the event; typically <see cref="Common.NavigationHelper"/>
|
|
/// </param>
|
|
/// <param name="e">Event data that provides both the navigation parameter passed to
|
|
/// <see cref="Frame.Navigate(Type, object)"/> when this page was initially requested and
|
|
/// a dictionary of state preserved by this page during an earlier
|
|
/// session. The state will be null the first time a page is visited.</param>
|
|
private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
|
|
{
|
|
}
|
|
|
|
#region NavigationHelper registration
|
|
|
|
/// The methods provided in this section are simply used to allow
|
|
/// NavigationHelper to respond to the page's navigation methods.
|
|
///
|
|
/// Page specific logic should be placed in event handlers for the
|
|
/// <see cref="Common.NavigationHelper.LoadState"/>
|
|
/// and <see cref="Common.NavigationHelper.SaveState"/>.
|
|
/// The navigation parameter is available in the LoadState method
|
|
/// in addition to page state preserved during an earlier session.
|
|
///
|
|
protected override void OnNavigatedTo(NavigationEventArgs e)
|
|
{
|
|
navigationHelper.OnNavigatedTo(e);
|
|
|
|
if (!(e.Parameter is GroupVm)) return;
|
|
DataContext = (GroupVm) e.Parameter;
|
|
groupsGridView.SelectedIndex = -1;
|
|
entriesListView.SelectedIndex = -1;
|
|
}
|
|
|
|
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
|
{
|
|
navigationHelper.OnNavigatedFrom(e);
|
|
}
|
|
|
|
#endregion
|
|
|
|
private void groupsGridView_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
{
|
|
var gridView = sender as GridView;
|
|
Frame.Navigate(typeof(GroupDetailPage), gridView?.SelectedItem as GroupVm);
|
|
}
|
|
|
|
|
|
private void entriesListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
{
|
|
var listView = sender as ListView;
|
|
Frame.Navigate(typeof(EntryDetailPage), listView?.SelectedItem as EntryVm);
|
|
}
|
|
}
|
|
}
|