Skip to content

Fixed: Selection isn't cleared when switching between panes #11745

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Files.App/Views/PaneHolderPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
x:Name="PaneLeft"
ContentChanged="Pane_ContentChanged"
IsPageMainPane="True"
Loaded="PaneLeft_Loaded"
Loaded="Pane_Loaded"
NavParams="{x:Bind NavParamsLeft, Mode=OneWay}"
PaneHolder="{x:Bind}" />

Expand All @@ -65,7 +65,7 @@
x:Name="PaneRight"
ContentChanged="Pane_ContentChanged"
IsPageMainPane="False"
Loaded="PaneRight_Loaded"
Loaded="Pane_Loaded"
NavParams="{x:Bind NavParamsRight, Mode=OneWay}"
PaneHolder="{x:Bind}" />
</Border>
Expand Down
17 changes: 9 additions & 8 deletions src/Files.App/Views/PaneHolderPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -330,19 +330,20 @@ public void CloseActivePane()
IsRightPaneVisible = false;
}

private void PaneLeft_Loaded(object sender, RoutedEventArgs e)
private void Pane_Loaded(object sender, RoutedEventArgs e)
{
(sender as UIElement).GotFocus += Pane_GotFocus;
}

private void PaneRight_Loaded(object sender, RoutedEventArgs e)
{
(sender as UIElement).GotFocus += Pane_GotFocus;
((UIElement)sender).GotFocus += Pane_GotFocus;
}

private void Pane_GotFocus(object sender, RoutedEventArgs e)
{
ActivePane = sender == PaneLeft ? PaneLeft : PaneRight;
var isLeftPane = sender == PaneLeft;
if (isLeftPane && (PaneRight?.SlimContentPage?.IsItemSelected ?? false))
PaneRight.SlimContentPage.ItemManipulationModel.ClearSelection();
else if (!isLeftPane && (PaneLeft?.SlimContentPage?.IsItemSelected ?? false))
PaneLeft.SlimContentPage.ItemManipulationModel.ClearSelection();

ActivePane = isLeftPane ? PaneLeft : PaneRight;
}

public void Dispose()
Expand Down