Some items view improvements for keyboards accelerators.
This commit is contained in:
@@ -58,6 +58,7 @@ public partial class GroupedEmailCollection : ObservableObject, IRecipient<Prope
|
|||||||
[NotifyPropertyChangedFor(nameof(HasSelectedItems))]
|
[NotifyPropertyChangedFor(nameof(HasSelectedItems))]
|
||||||
[NotifyPropertyChangedFor(nameof(HasSingleItemSelected))]
|
[NotifyPropertyChangedFor(nameof(HasSingleItemSelected))]
|
||||||
[NotifyPropertyChangedFor(nameof(HasMultipleItemsSelected))]
|
[NotifyPropertyChangedFor(nameof(HasMultipleItemsSelected))]
|
||||||
|
[NotifyPropertyChangedFor(nameof(IsAllItemsSelected))]
|
||||||
public partial int SelectedVisibleCount { get; set; }
|
public partial int SelectedVisibleCount { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -75,6 +76,41 @@ public partial class GroupedEmailCollection : ObservableObject, IRecipient<Prope
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HasMultipleItemsSelected => SelectedVisibleCount > 1;
|
public bool HasMultipleItemsSelected => SelectedVisibleCount > 1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether all mail items are currently selected.
|
||||||
|
/// Counts all mail items including those in threads, regardless of thread expansion state.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsAllItemsSelected
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var totalMailItems = _sourceItems.Count;
|
||||||
|
if (totalMailItems == 0) return false;
|
||||||
|
|
||||||
|
var selectedCount = 0;
|
||||||
|
|
||||||
|
// Count selected standalone emails (not in threads)
|
||||||
|
selectedCount += _sourceItems.Count(e => e.IsSelected && !e.IsDisplayedInThread);
|
||||||
|
|
||||||
|
// Count selected emails in threads
|
||||||
|
foreach (var expander in _threadExpanders.Values)
|
||||||
|
{
|
||||||
|
if (expander.IsSelected)
|
||||||
|
{
|
||||||
|
// If thread is selected, all emails in the thread are considered selected
|
||||||
|
selectedCount += expander.ThreadEmails.Count;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If thread is not selected, count only individually selected emails within the thread
|
||||||
|
selectedCount += expander.ThreadEmails.Count(e => e.IsSelected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return selectedCount == totalMailItems;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public GroupedEmailCollection()
|
public GroupedEmailCollection()
|
||||||
{
|
{
|
||||||
// Create a flat collection for ItemsView with headers, expanders and emails mixed
|
// Create a flat collection for ItemsView with headers, expanders and emails mixed
|
||||||
@@ -211,6 +247,10 @@ public partial class GroupedEmailCollection : ObservableObject, IRecipient<Prope
|
|||||||
{
|
{
|
||||||
HandleMailItemSelectionChanged(mailItem, message.NewValue);
|
HandleMailItemSelectionChanged(mailItem, message.NewValue);
|
||||||
}
|
}
|
||||||
|
else if (message.PropertyName == nameof(ThreadMailItemViewModel.IsSelected) && message.Sender is ThreadMailItemViewModel threadExpander)
|
||||||
|
{
|
||||||
|
HandleThreadSelectionChanged(threadExpander, message.NewValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleMailItemSelectionChanged(MailItemViewModel mailItem, bool isSelected)
|
private void HandleMailItemSelectionChanged(MailItemViewModel mailItem, bool isSelected)
|
||||||
@@ -247,6 +287,14 @@ public partial class GroupedEmailCollection : ObservableObject, IRecipient<Prope
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void HandleThreadSelectionChanged(ThreadMailItemViewModel threadExpander, bool isSelected)
|
||||||
|
{
|
||||||
|
// When a thread expander's selection changes, it affects the selection state of all emails in that thread
|
||||||
|
// We need to notify that the "all items selected" state might have changed
|
||||||
|
OnPropertyChanged(nameof(IsAllItemsSelected));
|
||||||
|
SelectionChanged?.Invoke(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Registers a mail item to track its selection state when added to the visible UI
|
/// Registers a mail item to track its selection state when added to the visible UI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -337,6 +385,9 @@ public partial class GroupedEmailCollection : ObservableObject, IRecipient<Prope
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notify that the "all items selected" state might have changed due to visible item count change
|
||||||
|
OnPropertyChanged(nameof(IsAllItemsSelected));
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@@ -606,6 +657,7 @@ public partial class GroupedEmailCollection : ObservableObject, IRecipient<Prope
|
|||||||
OnPropertyChanged(nameof(TotalCount));
|
OnPropertyChanged(nameof(TotalCount));
|
||||||
OnPropertyChanged(nameof(TotalUnreadCount));
|
OnPropertyChanged(nameof(TotalUnreadCount));
|
||||||
OnPropertyChanged(nameof(SelectedVisibleItems));
|
OnPropertyChanged(nameof(SelectedVisibleItems));
|
||||||
|
OnPropertyChanged(nameof(IsAllItemsSelected));
|
||||||
|
|
||||||
if (hadSelectedItems)
|
if (hadSelectedItems)
|
||||||
{
|
{
|
||||||
@@ -744,6 +796,9 @@ public partial class GroupedEmailCollection : ObservableObject, IRecipient<Prope
|
|||||||
// Update group header counts
|
// Update group header counts
|
||||||
UpdateAllGroupHeaderCounts();
|
UpdateAllGroupHeaderCounts();
|
||||||
|
|
||||||
|
// Notify that the "all items selected" state might have changed due to visible items rebuild
|
||||||
|
OnPropertyChanged(nameof(IsAllItemsSelected));
|
||||||
|
|
||||||
if (hadSelectedItems)
|
if (hadSelectedItems)
|
||||||
{
|
{
|
||||||
SelectionChanged?.Invoke(this, EventArgs.Empty);
|
SelectionChanged?.Invoke(this, EventArgs.Empty);
|
||||||
@@ -1073,29 +1128,31 @@ public partial class GroupedEmailCollection : ObservableObject, IRecipient<Prope
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Selects all visible mail items in the collection.
|
/// Selects all mail items in the collection.
|
||||||
/// Only operates on MailItemViewModel instances, skipping group headers and thread expanders.
|
/// Includes standalone mail items and all mail items inside threads, regardless of thread expansion state.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The number of items that were selected.</returns>
|
/// <returns>The number of items that were selected.</returns>
|
||||||
public int SelectAll()
|
public int SelectAll()
|
||||||
{
|
{
|
||||||
var selectedCount = 0;
|
var initialSelectedCount = SelectedItems.Count();
|
||||||
|
|
||||||
foreach (var item in Items)
|
// Select all standalone emails (not in threads)
|
||||||
{
|
foreach (var mailItem in _sourceItems.Where(e => !e.IsDisplayedInThread))
|
||||||
// Only select MailItemViewModel instances (skip GroupHeaderBase and ThreadMailItemViewModel)
|
|
||||||
if (item is MailItemViewModel mailItem)
|
|
||||||
{
|
|
||||||
if (!mailItem.IsSelected)
|
|
||||||
{
|
{
|
||||||
mailItem.IsSelected = true;
|
mailItem.IsSelected = true;
|
||||||
selectedCount++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Select all thread expanders (which automatically selects all emails within them)
|
||||||
|
foreach (var expander in _threadExpanders.Values)
|
||||||
|
{
|
||||||
|
expander.IsSelected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectedVisibleCount = _selectedVisibleItems.Count;
|
SelectedVisibleCount = _selectedVisibleItems.Count;
|
||||||
|
|
||||||
|
var finalSelectedCount = SelectedItems.Count();
|
||||||
|
var selectedCount = finalSelectedCount - initialSelectedCount;
|
||||||
|
|
||||||
if (selectedCount > 0)
|
if (selectedCount > 0)
|
||||||
{
|
{
|
||||||
SelectionChanged?.Invoke(this, EventArgs.Empty);
|
SelectionChanged?.Invoke(this, EventArgs.Empty);
|
||||||
@@ -1105,29 +1162,37 @@ public partial class GroupedEmailCollection : ObservableObject, IRecipient<Prope
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Clears the selection of all visible mail items in the collection.
|
/// Clears the selection of all mail items in the collection.
|
||||||
/// Only operates on MailItemViewModel instances, skipping group headers and thread expanders.
|
/// Includes standalone mail items and all mail items inside threads, regardless of thread expansion state.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The number of items that were deselected.</returns>
|
/// <returns>The number of items that were deselected.</returns>
|
||||||
public int ClearSelections()
|
public int ClearSelections()
|
||||||
{
|
{
|
||||||
var deselectedCount = 0;
|
var initialSelectedCount = SelectedItems.Count();
|
||||||
|
|
||||||
foreach (var item in Items)
|
// Deselect all standalone emails (not in threads)
|
||||||
{
|
foreach (var mailItem in _sourceItems.Where(e => !e.IsDisplayedInThread))
|
||||||
// Only deselect MailItemViewModel instances (skip GroupHeaderBase and ThreadMailItemViewModel)
|
|
||||||
if (item is MailItemViewModel mailItem)
|
|
||||||
{
|
|
||||||
if (mailItem.IsSelected)
|
|
||||||
{
|
{
|
||||||
mailItem.IsSelected = false;
|
mailItem.IsSelected = false;
|
||||||
deselectedCount++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deselect all thread expanders and individual emails in threads
|
||||||
|
foreach (var expander in _threadExpanders.Values)
|
||||||
|
{
|
||||||
|
expander.IsSelected = false;
|
||||||
|
|
||||||
|
// Also explicitly deselect individual emails within threads
|
||||||
|
foreach (var threadEmail in expander.ThreadEmails)
|
||||||
|
{
|
||||||
|
threadEmail.IsSelected = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectedVisibleCount = _selectedVisibleItems.Count;
|
SelectedVisibleCount = _selectedVisibleItems.Count;
|
||||||
|
|
||||||
|
var finalSelectedCount = SelectedItems.Count();
|
||||||
|
var deselectedCount = initialSelectedCount - finalSelectedCount;
|
||||||
|
|
||||||
if (deselectedCount > 0)
|
if (deselectedCount > 0)
|
||||||
{
|
{
|
||||||
SelectionChanged?.Invoke(this, EventArgs.Empty);
|
SelectionChanged?.Invoke(this, EventArgs.Empty);
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ public partial class MailListPageViewModel : MailBaseViewModel,
|
|||||||
|
|
||||||
private ThrottledEventHandler _selectionChangedThrottler;
|
private ThrottledEventHandler _selectionChangedThrottler;
|
||||||
|
|
||||||
|
public event EventHandler ThrottledSelectionChanged;
|
||||||
public GroupedEmailCollection MailCollection { get; set; } = new GroupedEmailCollection();
|
public GroupedEmailCollection MailCollection { get; set; } = new GroupedEmailCollection();
|
||||||
//public ObservableCollection<MailItemViewModel> SelectedItems { get; set; } = [];
|
//public ObservableCollection<MailItemViewModel> SelectedItems { get; set; } = [];
|
||||||
public ObservableCollection<FolderPivotViewModel> PivotFolders { get; set; } = [];
|
public ObservableCollection<FolderPivotViewModel> PivotFolders { get; set; } = [];
|
||||||
@@ -195,6 +196,8 @@ public partial class MailListPageViewModel : MailBaseViewModel,
|
|||||||
NotifyItemSelected();
|
NotifyItemSelected();
|
||||||
SetupTopBarActions();
|
SetupTopBarActions();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ThrottledSelectionChanged?.Invoke(this, EventArgs.Empty);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,8 +49,15 @@
|
|||||||
|
|
||||||
<SolidColorBrush x:Key="ButtonBackgroundDisabled">Transparent</SolidColorBrush>
|
<SolidColorBrush x:Key="ButtonBackgroundDisabled">Transparent</SolidColorBrush>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Virtualization is disabled because it messes up the selected items.
|
||||||
|
When item is unrealized, it's selection state is lost.
|
||||||
|
I don't want to intercept ItemContainer for it.
|
||||||
|
-->
|
||||||
|
|
||||||
<StackLayout
|
<StackLayout
|
||||||
x:Key="DefaultItemsViewLayout"
|
x:Key="DefaultItemsViewLayout"
|
||||||
|
IsVirtualizationEnabled="False"
|
||||||
Orientation="Vertical"
|
Orientation="Vertical"
|
||||||
Spacing="6" />
|
Spacing="6" />
|
||||||
|
|
||||||
@@ -61,13 +68,6 @@
|
|||||||
VerticalContentAlignment="Stretch"
|
VerticalContentAlignment="Stretch"
|
||||||
CanUserInvoke="UserCanInvoke"
|
CanUserInvoke="UserCanInvoke"
|
||||||
IsSelected="{x:Bind IsSelected, Mode=TwoWay}">
|
IsSelected="{x:Bind IsSelected, Mode=TwoWay}">
|
||||||
<animations:Implicit.ShowAnimations>
|
|
||||||
<animations:OpacityAnimation To="1.0" Duration="0:0:1" />
|
|
||||||
</animations:Implicit.ShowAnimations>
|
|
||||||
|
|
||||||
<animations:Implicit.HideAnimations>
|
|
||||||
<animations:OpacityAnimation To="0.0" Duration="0:0:1" />
|
|
||||||
</animations:Implicit.HideAnimations>
|
|
||||||
|
|
||||||
<controls:MailItemDisplayInformationControl
|
<controls:MailItemDisplayInformationControl
|
||||||
Margin="{x:Bind helpers:XamlHelpers.GetMailItemControlMargin(IsDisplayedInThread), Mode=OneWay}"
|
Margin="{x:Bind helpers:XamlHelpers.GetMailItemControlMargin(IsDisplayedInThread), Mode=OneWay}"
|
||||||
@@ -286,6 +286,7 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Canvas.ZIndex="100"
|
Canvas.ZIndex="100"
|
||||||
Checked="SelectAllCheckboxChecked"
|
Checked="SelectAllCheckboxChecked"
|
||||||
|
IsChecked="{x:Bind ViewModel.MailCollection.IsAllItemsSelected, Mode=OneWay}"
|
||||||
Unchecked="SelectAllCheckboxUnchecked" />
|
Unchecked="SelectAllCheckboxUnchecked" />
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using Microsoft.UI.Xaml.Media.Animation;
|
|||||||
using Microsoft.UI.Xaml.Navigation;
|
using Microsoft.UI.Xaml.Navigation;
|
||||||
using MoreLinq;
|
using MoreLinq;
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
|
using Windows.System;
|
||||||
using Wino.Controls;
|
using Wino.Controls;
|
||||||
using Wino.Core.Domain;
|
using Wino.Core.Domain;
|
||||||
using Wino.Core.Domain.Enums;
|
using Wino.Core.Domain.Enums;
|
||||||
@@ -57,16 +58,20 @@ public sealed partial class MailListPage : MailListPageAbstract,
|
|||||||
{
|
{
|
||||||
WeakReferenceMessenger.Default.Send(new ActiveMailFolderChangedEvent(folderNavigationArgs.BaseFolderMenuItem, folderNavigationArgs.FolderInitLoadAwaitTask));
|
WeakReferenceMessenger.Default.Send(new ActiveMailFolderChangedEvent(folderNavigationArgs.BaseFolderMenuItem, folderNavigationArgs.FolderInitLoadAwaitTask));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ViewModel.ThrottledSelectionChanged += ListSelectionChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ListSelectionChanged(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
UpdateSelectAllButtonStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnNavigatedFrom(e);
|
base.OnNavigatedFrom(e);
|
||||||
|
|
||||||
// Dispose all WinoListView items.
|
ViewModel.ThrottledSelectionChanged -= ListSelectionChanged;
|
||||||
|
|
||||||
// MailListView.Dispose();
|
|
||||||
|
|
||||||
this.Bindings.StopTracking();
|
this.Bindings.StopTracking();
|
||||||
|
|
||||||
RenderingFrame.Navigate(typeof(IdlePage));
|
RenderingFrame.Navigate(typeof(IdlePage));
|
||||||
@@ -79,13 +84,17 @@ public sealed partial class MailListPage : MailListPageAbstract,
|
|||||||
// Check all checkbox if all is selected.
|
// Check all checkbox if all is selected.
|
||||||
// Unhook events to prevent selection overriding.
|
// Unhook events to prevent selection overriding.
|
||||||
|
|
||||||
SelectAllCheckbox.Checked -= SelectAllCheckboxChecked;
|
//DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Low, () =>
|
||||||
SelectAllCheckbox.Unchecked -= SelectAllCheckboxUnchecked;
|
//{
|
||||||
|
// SelectAllCheckbox.Checked -= SelectAllCheckboxChecked;
|
||||||
|
// SelectAllCheckbox.Unchecked -= SelectAllCheckboxUnchecked;
|
||||||
|
|
||||||
SelectAllCheckbox.IsChecked = MailListView.CastedItemsSource?.Count() > 0 && MailListView.SelectedItems.Count == MailListView.CastedItemsSource.Count();
|
// bool isAllSelected = ViewModel.MailCollection.AllItems.All(a => a.IsSelected);
|
||||||
|
// SelectAllCheckbox.IsChecked = ViewModel.MailCollection.AllItems.Count() > 0 && isAllSelected;
|
||||||
|
|
||||||
SelectAllCheckbox.Checked += SelectAllCheckboxChecked;
|
// SelectAllCheckbox.Checked += SelectAllCheckboxChecked;
|
||||||
SelectAllCheckbox.Unchecked += SelectAllCheckboxUnchecked;
|
// SelectAllCheckbox.Unchecked += SelectAllCheckboxUnchecked;
|
||||||
|
//});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SelectionModeToggleChecked(object sender, RoutedEventArgs e) => ChangeSelectionMode(ItemsViewSelectionMode.Multiple);
|
private void SelectionModeToggleChecked(object sender, RoutedEventArgs e) => ChangeSelectionMode(ItemsViewSelectionMode.Multiple);
|
||||||
@@ -108,11 +117,9 @@ public sealed partial class MailListPage : MailListPageAbstract,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SelectAllCheckbox.IsChecked = false;
|
SelectAllCheckbox.IsChecked = false;
|
||||||
SelectionModeToggle.IsChecked = false;
|
SelectionModeToggle.IsChecked = false;
|
||||||
|
|
||||||
// MailListView.ClearSelections();
|
|
||||||
|
|
||||||
UpdateSelectAllButtonStatus();
|
UpdateSelectAllButtonStatus();
|
||||||
ViewModel.SelectedPivotChangedCommand.Execute(null);
|
ViewModel.SelectedPivotChangedCommand.Execute(null);
|
||||||
}
|
}
|
||||||
@@ -134,12 +141,12 @@ public sealed partial class MailListPage : MailListPageAbstract,
|
|||||||
|
|
||||||
private void SelectAllCheckboxChecked(object sender, RoutedEventArgs e)
|
private void SelectAllCheckboxChecked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
// MailListView.SelectAllWino();
|
ViewModel.MailCollection.SelectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SelectAllCheckboxUnchecked(object sender, RoutedEventArgs e)
|
private void SelectAllCheckboxUnchecked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
// MailListView.ClearSelections();
|
ViewModel.MailCollection.ClearSelections();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void MailItemContextRequested(UIElement sender, ContextRequestedEventArgs args)
|
private async void MailItemContextRequested(UIElement sender, ContextRequestedEventArgs args)
|
||||||
@@ -548,29 +555,9 @@ public sealed partial class MailListPage : MailListPageAbstract,
|
|||||||
private void ListSelectionChanged(ItemsView sender, ItemsViewSelectionChangedEventArgs args)
|
private void ListSelectionChanged(ItemsView sender, ItemsViewSelectionChangedEventArgs args)
|
||||||
{
|
{
|
||||||
UpdateSelectAllButtonStatus();
|
UpdateSelectAllButtonStatus();
|
||||||
SynchronizeSelectedItems();
|
|
||||||
|
|
||||||
UpdateAdaptiveness();
|
UpdateAdaptiveness();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static object _selectedItemsLock = new object();
|
|
||||||
private void SynchronizeSelectedItems()
|
|
||||||
{
|
|
||||||
//lock (_selectedItemsLock)
|
|
||||||
//{
|
|
||||||
// ViewModel.SelectedItems.Clear();
|
|
||||||
|
|
||||||
// foreach (var item in MailListView.SelectedItems)
|
|
||||||
// {
|
|
||||||
// if (item is MailItemViewModel mailItem)
|
|
||||||
// {
|
|
||||||
// if (!mailItem.IsSelected) mailItem.IsSelected = true;
|
|
||||||
// if (!ViewModel.SelectedItems.Contains(mailItem)) ViewModel.SelectedItems.Add(mailItem);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ThreadContainerRightTapped(object sender, RightTappedRoutedEventArgs e)
|
private void ThreadContainerRightTapped(object sender, RightTappedRoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is ItemContainer container && container.Tag is ThreadMailItemViewModel expander)
|
if (sender is ItemContainer container && container.Tag is ThreadMailItemViewModel expander)
|
||||||
@@ -600,30 +587,29 @@ public sealed partial class MailListPage : MailListPageAbstract,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void MailListView_ProcessKeyboardAccelerators(UIElement sender, ProcessKeyboardAcceleratorEventArgs args)
|
private void MailListView_ProcessKeyboardAccelerators(UIElement sender, ProcessKeyboardAcceleratorEventArgs args)
|
||||||
|
{
|
||||||
|
if (args.Key == VirtualKey.Delete)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// ItemsView have weird logic for selection inversion. We need to handle it manually.
|
// ItemsView have weird logic for selection inversion. We need to handle it manually.
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
|
|
||||||
ViewModel.MailCollection.SelectAll();
|
// TODO: If not all items are selected, select all. Otherwise clear selection.
|
||||||
|
|
||||||
// If not all items are selected, select all. Otherwise clear selection.
|
|
||||||
// Handle selections in the GroupedEmailCollection.
|
// Handle selections in the GroupedEmailCollection.
|
||||||
|
|
||||||
//if (MailListView.SelectedItems.Count < MailListView.CastedItemsSource?.Count())
|
ViewModel.MailCollection.SelectAll();
|
||||||
|
|
||||||
|
//if (!ViewModel.MailCollection.IsAllItemsSelected)
|
||||||
//{
|
//{
|
||||||
// // MailListView.SelectAllWino();
|
|
||||||
//}
|
//}
|
||||||
//else
|
//else
|
||||||
//{
|
//{
|
||||||
// // MailListView.ClearSelections();
|
// ViewModel.MailCollection.ClearSelections();
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SingleItemInvoked(ItemsView sender, ItemsViewItemInvokedEventArgs args)
|
|
||||||
{
|
|
||||||
if (args.InvokedItem is MailItemViewModel mailItem)
|
|
||||||
{
|
|
||||||
mailItem.IsSelected = !mailItem.IsSelected;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user