CollectionViewSource.IsSourceGrouped CollectionViewSource.IsSourceGrouped CollectionViewSource.IsSourceGrouped CollectionViewSource.IsSourceGrouped Property


Gets or sets a value that indicates whether source data is grouped.

public : Platform::Boolean IsSourceGrouped { get; set; }
bool IsSourceGrouped();

void IsSourceGrouped(bool issourcegrouped);
public bool IsSourceGrouped { get; set; }
Public ReadWrite Property IsSourceGrouped As bool
<CollectionViewSource IsSourceGrouped="bool" .../>

Property Value

bool bool

true if data is grouped. false if data is not grouped.


The following code example demonstrates how to bind a ListBox control to the results of a grouping LINQ query. In this example, a collection of teams is grouped by city and displayed with the city name as the group headers. For the complete code listing, see the XAML data binding sample. For additional example code on grouping, see the Grouped GridView sample.


    <CollectionViewSource x:Name="groupInfoCVS" IsSourceGrouped="true"/>

  <ListBox x:Name="lbGroupInfoCVS" 
    ItemsSource="{Binding Source={StaticResource groupInfoCVS}}">


            <TextBlock Text="{Binding Key}"/>



        <Border Background="{Binding Color}" 
          Width="200" CornerRadius="10" HorizontalAlignment="Left">

          <TextBlock Text="{Binding Name}" 
            Style="{StaticResource DescriptionTextStyle}" 
            HorizontalAlignment="Center" FontWeight="Bold"/>




Teams teams = new Teams();
var result = 
    from t in teams 
    group t by t.City into g 
    orderby g.Key 
    select g;
groupInfoCVS.Source = result;

See also