ListView

The ListView control is used to represent lists of data. A common use of the ListView is to show a list of files and associated (size, creation and modification dates, etc.) metadata columns in Windows Explorer. ListView items can be displayed in standard Explorer styles - e.g. Large Icons.

The ListView is an ItemsControl, which means it can contain objects of any type (such as string, image, or panel).

Properties

Key properties of ListView include:

  • Items. The items included in the ListView and the connected data are configured with the Edit Items option.
  • Columns. The columns available in the ListView are configured with the Edit Columns option.
  • Groups. Groups can be configured for the ListView using the Edit Groups option.

Events

Events can be configured for the ListView to specify the behaviour of the control. For example, an action can be configured to occur when a user clicks the control using the Click event property.

For information on configuring events and other components of the design using a script, see: Working with Scripts.

Adding a ListView

When you add a ListBox control to a form, click the control properties to Edit Items...

This will open the Collection Editor which you can use to add, configure or remove items in your list.

To create a ListViewItem to add an item to the list, click the Add button below the Members panel.

Us the options in the Properties panel to configure the details for the item. The Text field is used to enter the display text for the item.

Repeat the procedure to add each required item to the list, and click OK in the Collection Editor when complete.

To add columns to your ListView, select the Edit Columns option from the control properties. This will open the Collection Editor.

Click the Add button below the Members panel to add a ColumnHeader item to the ListView and configure the column header in the Properties panel.

When the columns for your list have been configured as required, click OK in the Collection Editor.

To create groups that can be used to group your ListViewItems, click the Edit Groups option in the control properties. This will open the Collection Editor.

Click the Add button at the bottom of the Members panel to add a ListViewGroup to your list and configure the group using the Properties pane.

You can add items to the groups you create using the Group property for each ListViewItem created.

When you have added the required groups, click OK in the Collection Editor. The ListView control is ready to be used on the form and will appear with the properties you configured.

Information on the Properties and Events for the ListView control can be found at the link to Microsoft® Documentation