Seaky Lone
Seaky Lone

Reputation: 1037

UWP Use Shy Header for ListView

I basically copied code from here and then changed variables to mine. I have also copied the files under the folder ExpressionBuilder.

And inside the ShyHeader.cs, there is such line of code:

var scrollViewer = gridView.GetFirstDescendantOfType<ScrollViewer>();

So I tried same thing for my ListView but it says undefined:

SongsListView.GetFirstDescendantOfType<ScrollViewer>()

So I put a ScrollViewer around the SongsListView and use that. But I fail to get it working for my project. The header is neither sticky above nor shy. It just gets scrolled normally. Can anyone help me debug it?

SongsListView is here.

SongsListView is used here in HeaderedPlaylistControl.

ShyHeader is implement here at the bottom.

HeaderPlaylistControl is used in AlbumPage, MyFavoritesPage and PlaylistsPage.

Upvotes: 0

Views: 132

Answers (1)

Nico Zhu
Nico Zhu

Reputation: 32775

So I tried same thing for my ListView but it says undefined

This is extension method for DependencyObject. You could find it here and copy it to you project.

So I put a ScrollViewer around the SongsListView and use that. But I fail to get it working for my project.

I checked your code, you need call SetShyHeadermet method when
PlaylistInfoGrid loaded.

private void PlaylistInfoGrid_Loaded(object sender, RoutedEventArgs e)
{
    SetShyHeader();
}

Upvotes: 1

Related Questions