From e530ba436af2488e79b6ae7c3d6ae173d9e13917 Mon Sep 17 00:00:00 2001 From: hishitetsu <66369541+hishitetsu@users.noreply.github.com> Date: Wed, 5 Apr 2023 22:21:39 +0900 Subject: [PATCH] Fix: Fixed right-clickable area in the recent files widget (#11979) --- .../Widgets/RecentFilesWidget.xaml | 115 +++++++++--------- .../Widgets/RecentFilesWidget.xaml.cs | 6 +- 2 files changed, 61 insertions(+), 60 deletions(-) diff --git a/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml b/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml index 82ee27f4a4c1..f1ce7e090488 100644 --- a/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml +++ b/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml @@ -51,66 +51,67 @@ - - - - - - - - - + + + + + + + + + - + - - + + + diff --git a/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml.cs b/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml.cs index a31639c4d49c..6bb6cb92de35 100644 --- a/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml.cs +++ b/src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml.cs @@ -101,11 +101,11 @@ public RecentFilesWidget() OpenFileLocationCommand = new RelayCommand(OpenFileLocation); } - private void Grid_RightTapped(object sender, RightTappedRoutedEventArgs e) + private void ListViewItem_RightTapped(object sender, RightTappedRoutedEventArgs e) { var itemContextMenuFlyout = new CommandBarFlyout { Placement = FlyoutPlacementMode.Full }; itemContextMenuFlyout.Opening += (sender, e) => App.LastOpenedFlyout = sender as CommandBarFlyout; - if (sender is not Grid recentItemsGrid || recentItemsGrid.DataContext is not RecentItem item) + if (sender is not ListViewItem listViewItem || listViewItem.DataContext is not RecentItem item) return; var menuItems = GetItemMenuItems(item, false); @@ -115,7 +115,7 @@ private void Grid_RightTapped(object sender, RightTappedRoutedEventArgs e) .ForEach(i => i.MinWidth = Constants.UI.ContextMenuItemsMaxWidth); secondaryElements.ForEach(i => itemContextMenuFlyout.SecondaryCommands.Add(i)); - itemContextMenuFlyout.ShowAt(recentItemsGrid, new FlyoutShowOptions { Position = e.GetPosition(recentItemsGrid) }); + itemContextMenuFlyout.ShowAt(listViewItem, new FlyoutShowOptions { Position = e.GetPosition(listViewItem) }); _ = ShellContextmenuHelper.LoadShellMenuItems(item.Path, itemContextMenuFlyout, showOpenWithMenu: true, showSendToMenu: true);