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

Containers Generation

The RadListView exposes several methods that can be overridden to customize the generated containers for the list view items and group headers.

Item Containers

The following methods can be used to generate and customize item containers in RadListView.

  • GetContainerForItem: Creates and returns an empty container (RadListViewItem instance) for list view item. The default RadListViewItem can be replaced with a custom implementation.
  • PrepareContainerForItem: Prepares the corresponding RadListViewItem container. It sets the item Style, DataContext, Content and ContentTemplate.
  • ClearContainerForItem: Clears the RadListViewItem container. The base method clears the DataContext property.

Group Headers

  • GetContainerForGroupHeader: Creates an empty container (ListViewGroupHeader instance) for list view group header.
  • PrepareContainerForGroupHeader: Prepares the corresponding ListViewGroupHeader container. It sets the header Style, DataContext and ContentTemplate.
  • ClearContainerForGroupHeader: Clears the ListViewGroupHeader container. The base method clears the DataContext property.


Example 1: Using custom RadListViewItem in RadListView

public class CustomListView : RadListView 
    protected override RadListViewItem GetContainerForItem() 
        return new CustomListViewItem(); 
    protected override void PrepareContainerForItem(RadListViewItem item, object context) 
        base.PrepareContainerForItem(item, context); 
        (item as CustomListViewItem).IsPrepared = true; 
    protected override void ClearContainerForItem(RadListViewItem item) 
        (item as CustomListViewItem).IsPrepared = false; 
public class CustomListViewItem : RadListViewItem 
    public bool IsPrepared { get; set; } 
In this article
Not finding the help you need?