New to Telerik UI for WinForms? Download free 30-day trial

Adding columns

When the RadListView.ViewType property is set to DetailsView, the data can be displayed in columns view. Adding columns to the control at design time, is done by populating the Columns collection of RadListView. This collection can be accessed either through the Columns property in the property grid of the control or through the Smart Tag of RadListView.

Figure 1: Columns option in Smart Tag

listview-working-with-design-time-adding-columns 001

Figure 2: Columns option in Properties section

listview-working-with-design-time-adding-columns 002

Once ListViewDetailColumn Collection Editor is opened, you can add as many columns as you need, and also, you can modify their properties in the property grid.

Figure 3: ListViewDetailColumn Collection Editor

listview-working-with-design-time-adding-columns 003

Once the Columns collection is populated, you can assign values for each column of each ListViewDataItem, by making use of the SubItems property (this property is available in design-time only):

Figure 4: Fill cells' values

listview-working-with-design-time-adding-columns 004

Here is the result of the explained operations:

listview-working-with-design-time-adding-columns 005

Note if you assign a DataSource programmatically, this will use the default column widths. To handle this scenario, use the ColumnCreating event to access column by field name and set the desired width there.

See Also

In this article
Not finding the help you need? Improve this article