Scroll to top of the playlist on playlist change.
This commit is contained in:
@@ -58,6 +58,22 @@ public sealed partial class PlaylistDetailView : UserControl
|
|||||||
|
|
||||||
UpdateListViewItemStyle(listViewItem, true);
|
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)
|
private void UpdateListViewItemStyle(FrameworkElement listViewItem, bool isPlaying)
|
||||||
|
|||||||
Reference in New Issue
Block a user