Content Model: ListView is an ItemsControl. Its content properties are Items and ItemsSource. For more information on the content model for ListView, see Controls Content Model Overview.
The presentation of the data items in a ListView is defined by its view mode, which is specified by the View property. Windows Presentation Foundation (WPF) provides a GridView view mode that partitions the ListView data item content into columns. The properties and methods on GridView and its related classes style and specify the content of the columns.
The following illustration shows a ListView with a GridView view.
.jpg)
You can also define custom views by creating a class that derives from ViewBase. For more information, see How to: Create a Custom View Mode for a ListView.
If you define a custom ItemContainerStyle for a ListView control and also define an ItemTemplate, you must include a ContentPresenter in the ItemContainerStyle. The ContentPresenter is required for the ItemTemplate to work correctly.
To avoid alignment issues in a GridView view mode, do not add content or set properties that affect the width of an item in the ItemContainerStyle of a ListView. To prevent alignment issues, use properties and templates that are defined for the GridView view mode. This includes properties and templates that are defined for classes that are used in a GridView view mode, such as GridViewColumn and GridViewColumnHeader.
Two ListView controls cannot share the same view. To specify a view that can be used more than one time, use templates or styles. For an example of a GridView and other custom views that are defined as reusable resources, see ListView with Multiple Views Sample.
Do not use the HorizontalContentAlignment and VerticalContentAlignment properties for ListView content that is displayed by using a GridView. To specify the alignment of content in a column of a GridView, define a CellTemplate.
Displaying a large number of items may cause performance issues. See Optimizing Performance: Controls for more information.
Dependency properties for this control might be set by the control’s default style. If a property is set by a default style, the property might change from its default value when the control appears in the application. The default style is determined by which desktop theme is used when the application is running. For more information, see Themes.