diff --git a/src/ViewModels/StashesPage.cs b/src/ViewModels/StashesPage.cs index 9fbb5582d..08e45b6da 100644 --- a/src/ViewModels/StashesPage.cs +++ b/src/ViewModels/StashesPage.cs @@ -147,9 +147,7 @@ public ContextMenu MakeContextMenu(Models.Stash stash) apply.Icon = App.CreateMenuIcon("Icons.CheckCircled"); apply.Click += (_, ev) => { - if (_repo.CanCreatePopup()) - _repo.ShowPopup(new ApplyStash(_repo, stash)); - + Apply(stash); ev.Handled = true; }; @@ -158,9 +156,7 @@ public ContextMenu MakeContextMenu(Models.Stash stash) drop.Icon = App.CreateMenuIcon("Icons.Clear"); drop.Click += (_, ev) => { - if (_repo.CanCreatePopup()) - _repo.ShowPopup(new DropStash(_repo, stash)); - + Drop(stash); ev.Handled = true; }; @@ -307,6 +303,12 @@ public void ClearSearchFilter() SearchFilter = string.Empty; } + public void Apply(Models.Stash stash) + { + if (stash != null && _repo.CanCreatePopup()) + _repo.ShowPopup(new ApplyStash(_repo, stash)); + } + public void Drop(Models.Stash stash) { if (stash != null && _repo.CanCreatePopup()) diff --git a/src/Views/StashesPage.axaml b/src/Views/StashesPage.axaml index a61aad992..3bd95a120 100644 --- a/src/Views/StashesPage.axaml +++ b/src/Views/StashesPage.axaml @@ -65,6 +65,7 @@ ItemsSource="{Binding VisibleStashes}" SelectedItem="{Binding SelectedStash, Mode=TwoWay}" SelectionMode="Single" + DoubleTapped="OnStashListDoubleTapped" KeyDown="OnStashListKeyDown" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Auto"> diff --git a/src/Views/StashesPage.axaml.cs b/src/Views/StashesPage.axaml.cs index 34c44214f..4bddd3a67 100644 --- a/src/Views/StashesPage.axaml.cs +++ b/src/Views/StashesPage.axaml.cs @@ -23,6 +23,15 @@ private void OnMainLayoutSizeChanged(object sender, SizeChangedEventArgs e) layout.StashesLeftWidth = new GridLength(maxLeft, GridUnitType.Pixel); } + private void OnStashListDoubleTapped(object _, TappedEventArgs e) + { + if (DataContext is not ViewModels.StashesPage vm) + return; + + vm.Apply(vm.SelectedStash); + e.Handled = true; + } + private void OnStashListKeyDown(object sender, KeyEventArgs e) { if (e.Key is not (Key.Delete or Key.Back))