Xceed DataGrid for Silverlight Documentation
DefaultGroupConfiguration Property
Example 


Gets or sets the default group configuration, which will be used for all groups whose group description does not explicitly define a group configuration.
Syntax
'Declaration
 
Public Property DefaultGroupConfiguration As DataGridGroupConfiguration
'Usage
 
Dim instance As DataGridControl
Dim value As DataGridGroupConfiguration
 
instance.DefaultGroupConfiguration = value
 
value = instance.DefaultGroupConfiguration
public DataGridGroupConfiguration DefaultGroupConfiguration {get; set;}

Property Value

A DataGridGroupConfiguration representing the default group configuration, which will be used for all groups whose group description does not explicitly define a group configuration.
Remarks
Some themes, such as the Signature, Metro, and Live Explorer themes, contain implicit styles that target DataGridControl and define a "default" group-configuration selector. In order to prevent the values returned by the selector from being inherited by group configurations, the GroupConfigurationSelector property defined by the DataGridControl class can  be set to null (Nothing in Visual Basic) or a new selector can be provided (see #3 in the diagram below).

This means that if a theme that defines a group-configuration selector is used and a default group configuration is provided through the DefaultGroupConfiguration property, the default group configuration will be ignored, usually only for first-level groups.
Example
The following example demonstrates how to provide a default group configuration.
<sldg:DataGridControl x:Name="sldgDataGridControl"   
                      ItemsSource="{Binding Path=Orders}">               
    <sldg:DataGridControl.GroupDescriptions>
        <sldg:DataGridGroupDescription PropertyName="ShipCity"/>
    </sldg:DataGridControl.GroupDescriptions>

    <sldg:DataGridControl.DefaultGroupConfiguration>
        <sldg:DataGridGroupConfiguration>
            <sldg:DataGridGroupConfiguration.Footers>
                <DataTemplate>
                    <Button Content="Select Items in Group"
                            Click="SelectGroupItems_Click"
                            Tag="{Binding}"/>
                </DataTemplate>
            </sldg:DataGridGroupConfiguration.Footers>
        </sldg:DataGridGroupConfiguration>
    </sldg:DataGridControl.DefaultGroupConfiguration>
</sldg:DataGridControl>
Private Sub SelectGroupItems_Click( ByVal sender As Object, ByVal e As RoutedEventArgs )
  Dim context As  GroupHeaderFooterContext  = CType( CType( sender, Button ).Tag, GroupHeaderFooterContext )

   If Not context Is Nothing Then
      Dim propertyName As String = CType( context.GroupDescription, DataGridGroupDescription ).PropertyName
      Dim range As New SelectionRange( New SortDescription() { New SortDescription( propertyName, ListSortDirection.Ascending ) }, Nothing, Nothing )

      range.StartRangeInfos.Add( propertyName, context.GroupValue )
      range.EndRangeInfos.Add( propertyName, context.GroupValue )

      Me.sldgDataGridControl.SelectedRanges.Clear()
      Me.sldgDataGridControl.SelectedRanges.Add( range )
   End If
End Sub
private void SelectGroupItems_Click( object sender, RoutedEventArgs e )
{
   GroupHeaderFooterContext context = ( ( Button )sender ).Tag as GroupHeaderFooterContext;

   if( context != null )
   {
      string propertyName = ( ( DataGridGroupDescription )context.GroupDescription ).PropertyName;
      SelectionRange range = new SelectionRange( new SortDescription[] { new SortDescription( propertyName, ListSortDirection.Ascending ) }, null, null );

      range.StartRangeInfos.Add( propertyName, context.GroupValue );
      range.EndRangeInfos.Add( propertyName, context.GroupValue );

      this.sldgDataGridControl.SelectedRanges.Clear();
      this.sldgDataGridControl.SelectedRanges.Add( range );
   }
}
Requirements

Target Platforms: Windows 7, Windows Vista, Windows XP SP3, Windows Server 2008 family

See Also

Reference

DataGridControl Class
DataGridControl Members

Manipulating Data

Grouping Data

Send Feedback