Xceed DataGrid for Silverlight Documentation
FixedHeaders Property (DataGridGroupConfiguration)
Example 


Gets a collection of DataTemplates that represent the items that are located in the fixed header sections of the groups to which the configuration is applied.
Syntax
'Declaration
 
Public ReadOnly Property FixedHeaders As ObservableCollection(Of DataTemplate)
'Usage
 
Dim instance As DataGridGroupConfiguration
Dim value As ObservableCollection(Of DataTemplate)
 
value = instance.FixedHeaders
public ObservableCollection<DataTemplate> FixedHeaders {get;}

Property Value

A generic ObservableCollection of DataTemplates that represent the items that are located in the fixed header sections of the groups to which the configuration is applied.

Elements contained in the fixed header section of a group will remain visible when the containing group is collapsed.

Remarks

All items added to a header or footer section must be provided as a DataTemplate.

The GroupContext attached property will only be set on the first (i.e., root) element in the DataTemplate and can be accessed through a RelativeSource binding using the Self mode (see example below). Any child elements in the template can access the parent's GroupContext through an ElementName binding. For example:

<TextBlock Text="{Binding ElementName=parentPanel,
                                         Path=(sldg:DataGridControl.GroupContext).GroupValue}" />

Example
The following example demonstrates how to add a control to the fixed headers of a group (select all items in a group).
<sldg:DataGridControl x:Name="sldgDataGridControl"
                      ItemsSource="{Binding Path=Orders}">

      <sldg:DataGridControl.GroupDescriptions>
        <sldg:DataGridGroupDescription PropertyName="Age">
            <sldg:DataGridGroupDescription.GroupConfiguration>
                <sldg:DataGridGroupConfiguration>
                    <sldg:DataGridGroupConfiguration.FixedHeaders>
                        <DataTemplate>
                            <Button Content="Select Items in Group"
                                    Click="SelectGroupItems_Click"
                                    Tag="{Binding RelativeSource={RelativeSource Self}, Path=(sldg:DataGridControl.GroupContext)}" />
                        </DataTemplate>
                    </sldg:DataGridGroupConfiguration.FixedHeaders>
                </sldg:DataGridGroupConfiguration>
            </sldg:DataGridGroupDescription.GroupConfiguration>
        </sldg:DataGridGroupDescription>
    </sldg:DataGridControl.GroupDescriptions>
</sldg:DataGridControl>
Private Sub SelectGroupItems_Click( ByVal sender As Object, ByVal e As RoutedEventArgs )
  Dim context As  GroupContext  = CType( CType( sender, Button ).Tag, GroupContext )
   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 )
{
   GroupContext context = ( ( Button )sender ).Tag as GroupContext; 

   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

DataGridGroupConfiguration Class
DataGridGroupConfiguration Members

Send Feedback