Scroll to top of the playlist on playlist change.

This commit is contained in:
2026-07-31 09:03:00 -04:00
parent 6484f2120e
commit 8864da7a75

View File

@@ -58,6 +58,22 @@ public sealed partial class PlaylistDetailView : UserControl
UpdateListViewItemStyle(listViewItem, true);
}
else if (e.PropertyName == nameof(_viewModel.Playlist))
{
ScrollToTop();
}
}
private void ScrollToTop()
{
if (PlaylistListView.FindDescendant<ScrollViewer>() is ScrollViewer scrollViewer)
{
scrollViewer.ChangeView(null, 0, null, disableAnimation: false);
}
else if (_viewModel.FilteredPlaylistSongs.FirstOrDefault() is PlaylistSong firstSong)
{
PlaylistListView.ScrollIntoView(firstSong);
}
}
private void UpdateListViewItemStyle(FrameworkElement listViewItem, bool isPlaying)