Skip to content

Commit 890f58a

Browse files
authored
Fix: Fixed selecting wrong items when creating or renaming an item (#11237)
1 parent 720edcf commit 890f58a

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,16 @@ private void SetCheckboxSelectionState(object item, ListViewItem? lviContainer =
714714
{
715715
var checkbox = container.FindDescendant("SelectionCheckbox") as CheckBox;
716716
if (checkbox is not null)
717+
{
718+
// Temporarily disable events to avoid selecting wrong items
719+
checkbox.Checked -= ItemSelected_Checked;
720+
checkbox.Unchecked -= ItemSelected_Unchecked;
721+
717722
checkbox.IsChecked = FileList.SelectedItems.Contains(item);
723+
724+
checkbox.Checked += ItemSelected_Checked;
725+
checkbox.Unchecked += ItemSelected_Unchecked;
726+
}
718727
}
719728
}
720729

src/Files.App/Views/LayoutModes/GridViewBrowser.xaml.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,16 @@ private void SetCheckboxSelectionState(object item, GridViewItem? lviContainer =
471471
{
472472
var checkbox = container.FindDescendant("SelectionCheckbox") as CheckBox;
473473
if (checkbox is not null)
474+
{
475+
// Temporarily disable events to avoid selecting wrong items
476+
checkbox.Checked -= ItemSelected_Checked;
477+
checkbox.Unchecked -= ItemSelected_Unchecked;
478+
474479
checkbox.IsChecked = FileList.SelectedItems.Contains(item);
480+
481+
checkbox.Checked += ItemSelected_Checked;
482+
checkbox.Unchecked += ItemSelected_Unchecked;
483+
}
475484
}
476485
}
477486

0 commit comments

Comments
 (0)