Skip to content

Feature: Scroll to the selected file when using "Open file location" #13133

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
6 changes: 4 additions & 2 deletions src/Files.App/Views/LayoutModes/ColumnViewBrowser.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
SearchQuery = navigationArguments.SearchQuery,
SearchUnindexedItems = navigationArguments.SearchUnindexedItems,
SearchPathParam = navigationArguments.SearchPathParam,
NavPathParam = path
NavPathParam = path,
SelectItems = path == navigationArguments.NavPathParam? navigationArguments.SelectItems : null
});

var index = 0;
Expand All @@ -125,7 +126,8 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
frame.Navigate(typeof(ColumnShellPage), new ColumnParam
{
Column = ++index,
NavPathParam = path
NavPathParam = path,
SelectItems = path == navigationArguments.NavPathParam? navigationArguments.SelectItems : null
});
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ protected override void ItemManipulationModel_ScrollIntoViewInvoked(object? send

protected override void ItemManipulationModel_FocusSelectedItemsInvoked(object? sender, EventArgs e)
{
if (SelectedItems.Any())
if (SelectedItems?.Any() ?? false)
{
FileList.ScrollIntoView(SelectedItems.Last());
ContentScroller?.ChangeView(null, FileList.Items.IndexOf(SelectedItems.Last()) * Convert.ToInt32(Application.Current.Resources["ListItemHeight"]), null, false);
(FileList.ContainerFromItem(SelectedItems.Last()) as ListViewItem)?.Focus(FocusState.Keyboard);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/Files.App/Views/Shells/ColumnShellPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ protected override void OnNavigationParamsChanged()
NavPathParam = ColumnParams.NavPathParam,
SearchUnindexedItems = ColumnParams.SearchUnindexedItems,
SearchPathParam = ColumnParams.SearchPathParam,
AssociatedTabInstance = this
AssociatedTabInstance = this,
SelectItems = ColumnParams.SelectItems
});
}

Expand Down