Often you need to display a list of items in a application. The Windows Library for JavaScript contains a ListView control for you to use in your applications. The control can be bound to a data source and templated from HTML.
Getting started
We’ll start off by creating a new project and choosing the
Fixed Layout Application project template.
As you can see, the template has added a paragraph (
p) to the tree which contains some text. You can use that to place the title of your application. The ListView is going to be in the same
div as that paragraph. You can add the ListView by hand, typing the HTML, but I personally prefer dragging and dropping controls onto the designer. Select the parent
div of the paragraph. Type
ListView in the search box of the
Assets panel and drag the result from the list to the design surface. If you switch to
Split view in the designer you can see the HTML … which should contain the following element.
<div data-win-control="WinJS.UI.ListView"></div>
To be able to write code against the ListView it has to have an Id. You can enter this on the Attributes panel. In this ...