From 4958f6c158d3806a628fbf82af034bd00c2c3783 Mon Sep 17 00:00:00 2001 From: Davide Giacometti Date: Tue, 5 Jan 2021 16:01:42 +0100 Subject: [PATCH] reset scrollviewer on page change (#8742) --- .../Microsoft.PowerToys.Settings.UI/Views/ShellPage.xaml | 6 ++++-- .../Views/ShellPage.xaml.cs | 9 +++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ShellPage.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ShellPage.xaml index a5b950c92f..59e274a377 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ShellPage.xaml +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ShellPage.xaml @@ -27,7 +27,8 @@ IsSettingsVisible="False" OpenPaneLength="296" CompactModeThresholdWidth="0" - Background="{ThemeResource SystemControlBackgroundAltHighBrush}"> + Background="{ThemeResource SystemControlBackgroundAltHighBrush}" + SelectionChanged="NavigationView_SelectionChanged"> @@ -103,7 +104,8 @@ - + diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ShellPage.xaml.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ShellPage.xaml.cs index 482e85d7b1..9a82503ade 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ShellPage.xaml.cs +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ShellPage.xaml.cs @@ -2,9 +2,8 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; using System.Collections.Generic; -using Microsoft.PowerToys.Settings.UI.Library; +using System.Diagnostics.CodeAnalysis; using Microsoft.PowerToys.Settings.UI.ViewModels; using Windows.Data.Json; using Windows.UI.Xaml.Controls; @@ -129,5 +128,11 @@ namespace Microsoft.PowerToys.Settings.UI.Views { shellFrame.Navigate(typeof(GeneralPage)); } + + [SuppressMessage("Usage", "CA1801:Review unused parameters", Justification = "Params are required for event handler signature requirements.")] + private void NavigationView_SelectionChanged(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewSelectionChangedEventArgs args) + { + scrollViewer.ChangeView(null, 0, null, true); + } } }