If you set the Items Source property and you add an item to the Items collection in code, an exception is thrown. To specify exactly how items in the list view are displayed, you create a Data Template.Note Many of the examples in this article populate the Items collection directly for the sake of simplicity. The XAML in the Data Template defines the layout and appearance of controls used to display an individual item.Data is stacked horizontally until it fills the columns, then continues with the next row.
When you define the items in XAML, they are automatically added to the Items collection. List View list View1 = new List View(); list View1. In this article, we use simple string data for most of the examples, and don't specify a data template.It must have items in its Items collection before it can show anything on the screen. Items Source = list Items; // Add the list view to a parent container in the visual tree. The Collection View Source acts as a proxy for the collection class in XAML and enables grouping support. An item’s data template defines how the data is visualized.To populate the view, you can add items directly to the Items collection, or set the Items Source property to a data source. You typically use a list view to display data from a source such as a database or the Internet. By default, a data item is displayed in the list view as the string representation of the data object it's bound to.We may refer to classes like List View or List View Item, but the “List” prefix can be replaced with “Grid” for the corresponding grid equivalent (Grid View or Grid View Item).The List View displays data stacked vertically in a single column.