PagedCollectionView.CanGroup Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets a value that indicates whether this view supports grouping.

Namespace:  System.Windows.Data
Assembly:  System.Windows.Data (in System.Windows.Data.dll)


Public ReadOnly Property CanGroup As Boolean
public bool CanGroup { get; }

Property Value

Type: System.Boolean
true in all cases.




This implementation always returns true.

Typically, you use this property to test whether the view supports grouping before setting the GroupDescriptions property.


The following code example demonstrates how to add group descriptions to the GroupDescriptions collection to group data in a DataGrid display. This example is part of a larger example available in the How to: Group, Sort, and Filter Data in the DataGrid Control topic.

If taskListView.CanGroup = True Then
    ' Group tasks by ProjectName...
    taskListView.GroupDescriptions.Add(New PropertyGroupDescription("ProjectName"))
    ' Then group by Complete status.
    taskListView.GroupDescriptions.Add(New PropertyGroupDescription("Complete"))
End If
if (taskListView.CanGroup == true)
    // Group tasks by ProjectName...
    taskListView.GroupDescriptions.Add(new PropertyGroupDescription("ProjectName"));
    // Then group by Complete status.
    taskListView.GroupDescriptions.Add(new PropertyGroupDescription("Complete"));

Version Information


Supported in: 5, 4, 3


For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.