Skip to content

Commit

Permalink
improve play queue select all shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
United600 committed Jan 25, 2025
1 parent 92a62a1 commit 6e91661
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Screenbox/Controls/PlaylistView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@
<ListView.KeyboardAccelerators>
<KeyboardAccelerator
Key="A"
Invoked="PlaylistListViewSelectAllKeyboardAccelerator_OnInvoked"
Invoked="SelectDeselectAllKeyboardAccelerator_OnInvoked"
Modifiers="Control" />
</ListView.KeyboardAccelerators>
<interactivity:Interaction.Behaviors>
Expand Down
17 changes: 13 additions & 4 deletions Screenbox/Controls/PlaylistView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Windows.Storage;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;

// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236

Expand Down Expand Up @@ -137,13 +138,21 @@ private void PlaylistView_OnUnloaded(object sender, RoutedEventArgs e)
ViewModel.PropertyChanged -= ViewModelOnPropertyChanged;
}

private void PlaylistListViewSelectAllKeyboardAccelerator_OnInvoked(Windows.UI.Xaml.Input.KeyboardAccelerator sender, Windows.UI.Xaml.Input.KeyboardAcceleratorInvokedEventArgs args)
private void SelectDeselectAllKeyboardAccelerator_OnInvoked(Windows.UI.Xaml.Input.KeyboardAccelerator sender, Windows.UI.Xaml.Input.KeyboardAcceleratorInvokedEventArgs args)
{
if (PlaylistListView.Items.Count > 0)
{
MultiSelectToggle.IsChecked = true;
PlaylistListView.SelectAll();
args.Handled = true;
if (PlaylistListView.SelectedItems.Count != ViewModel.Playlist.Items.Count)
{
MultiSelectToggle.IsChecked = true;
PlaylistListView.SelectRange(new ItemIndexRange(0, (uint)PlaylistListView.Items.Count));
args.Handled = true;
}
else
{
PlaylistListView.DeselectRange(new ItemIndexRange(0, (uint)PlaylistListView.Items.Count));
args.Handled = true;
}
}
}
}
Expand Down

0 comments on commit 6e91661

Please sign in to comment.