diff --git a/src/Files.App/Views/Layouts/ColumnLayoutPage.xaml.cs b/src/Files.App/Views/Layouts/ColumnLayoutPage.xaml.cs index 71090606b7e1..3776eae8bcd3 100644 --- a/src/Files.App/Views/Layouts/ColumnLayoutPage.xaml.cs +++ b/src/Files.App/Views/Layouts/ColumnLayoutPage.xaml.cs @@ -538,6 +538,11 @@ private async void FileList_ItemTapped(object sender, TappedRoutedEventArgs e) else { CloseFolder(); + + // Clear selection when clicking empty area via touch + // https://github.com/files-community/Files/issues/15051 + if (e.PointerDeviceType == PointerDeviceType.Touch) + ItemManipulationModel.ClearSelection(); } } diff --git a/src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs b/src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs index aba8740b9d4c..8df75467a078 100644 --- a/src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs +++ b/src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs @@ -567,6 +567,13 @@ private async void FileList_ItemTapped(object sender, TappedRoutedEventArgs e) await CommitRenameAsync(textBox); } } + else + { + // Clear selection when clicking empty area via touch + // https://github.com/files-community/Files/issues/15051 + if (e.PointerDeviceType == PointerDeviceType.Touch) + ItemManipulationModel.ClearSelection(); + } return; } diff --git a/src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs b/src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs index 1c16bacedfc4..fc8c900678a8 100644 --- a/src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs +++ b/src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs @@ -610,7 +610,14 @@ private async void FileList_ItemTapped(object sender, TappedRoutedEventArgs e) var item = (e.OriginalSource as FrameworkElement)?.DataContext as ListedItem; if (item is null) + { + // Clear selection when clicking empty area via touch + // https://github.com/files-community/Files/issues/15051 + if (e.PointerDeviceType == PointerDeviceType.Touch) + ItemManipulationModel.ClearSelection(); + return; + } // Skip code if the control or shift key is pressed or if the user is using multiselect if (ctrlPressed ||