Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sticky header in ListView and GridView WinRT xaml

How could one accomplish behavior in which a header of a ListView or GridView group doesn't scroll with the content, but stays fixed until the content comes to an end and the following header then comes in focus.

The behavior can be observed in Finance app on Windows 8 Release Preview when you scroll through GridView items.

I am not expecting the whole code, but I'd like to hear some ideas, links, code snippets, samples etc. which would help me get started.

Thanks

like image 704
Igor Ralic Avatar asked Jul 09 '12 09:07

Igor Ralic


2 Answers

You might be able to embed a listview in a datatemplate of the main listview. Then you can embed a gridview and gridviewcolumns in the templated listviews and get your column headers that way.

like image 146
Ravi Avatar answered Oct 21 '22 13:10

Ravi


Wrap the ListView in a ScrollViewer. The ListView's internal SrollViewer won't be used, and you'll have control of the outer ScrollViewer, which will allow you to set its TopHeader.

<ScrollViewer>
    <ScrollViewer.TopHeader>
        ... Your header content here ...
    </ScrollViewer.TopHeader>
    <ListView HorizontalAlignment="Left" VerticalAlignment="Top">
        ... Your body content here ...
    </ListView>
</ScrollViewer>
like image 34
Edward Brey Avatar answered Oct 21 '22 14:10

Edward Brey