locked
Grouped listview layout with one column

    Question

  • Hello,
    I would like to show the listview items as a data table (windows 8.1). I am using the listview but the grouped items are wrapped based on the height. I would like to have only one column per group and eventually the vertical scrollbar if items don't fit vertically.

    Before I add a grid with one listview per column, I'd like to know if it is possible. I found maxRows properties, but not maxColumns.

    Thanks,
    Pedro. 

    Wednesday, May 14, 2014 2:40 PM

Answers

  • The ListView won't inherently do this for you, but there are two approaches you can take.

    One is to implement a custom layout for the ListView where you can do whatever you need. For details on that, see Appendix B of my free ebook, Programming Windows Store Apps with HTML, CSS, and JavaScript, which really does have the best reference material I know of for custom layouts as it builds on the SDK sample and other docs.

    The second possibility is to use a WinJS.UI.Hub control, which means creating separate data sources for each group and then creating a HubSection for each source in which you place a ListView that uses the ListLayout layout to do vertical panning. Chapter 8 of my same book talks about the Hub control, or you can just go to the Hub control sample which is pretty straightforward to work with.

    Kraig

    Author, Programming Windows Store Apps with HTML, CSS, and JavaScript, Second Edition, a free ebook from Microsoft Press.


    Wednesday, May 14, 2014 9:14 PM