Xceed DataGrid for Silverlight Documentation
StatFunctions Property (DataGridGroupConfiguration)
Example 


Gets a collection of the statistical functions whose results can be displayed by various elements within any groups to which the configuration is applied.
Syntax
'Declaration
 
Public ReadOnly Property StatFunctions As StatFunctionCollection
'Usage
 
Dim instance As DataGridGroupConfiguration
Dim value As StatFunctionCollection
 
value = instance.StatFunctions
public StatFunctionCollection StatFunctions {get;}

Property Value

A StatFunctionCollection that contains a collection of statistical functions whose results can be displayed by various elements within any groups to which the configuration is applied (see Remarks below).
Remarks
Statistical functions defined at the grid level can only be displayed at the grid level or outside the grid. Likewise, statistical functions defined in a group configuration are only available to the groups to which the configuration is applied.
Example
<Grid x:Name="LayoutRoot">
   <Grid.RowDefinitions>
      <RowDefinition Height="24" />
      <RowDefinition />
   </Grid.RowDefinitions>       

   <!-- Only the statistics that are calculated at the grid level can be accessed and displayed outside the grid. -->
   <TextBlock Text="{Binding ElementName=sldgDataGridControl, Path=(sldg:DataGridControl.StatContext)[TOTALPERSONCOUNT].Value, StringFormat='{}{0} people in total'}"
              Grid.Row="0" />
   <sldg:DataGridControl x:Name="sldgDataGridControl"
                         ItemsSource="{Binding Path=People}"
                         AutoCreateColumns="False"
                         Grid.Row="1">     
   
      <sldg:DataGridControl.GroupDescriptions>
         <sldg:DataGridGroupDescription PropertyName="Age">
            <sldg:DataGridGroupDescription.GroupConfiguration>
               <sldg:DataGridGroupConfiguration>
                  <sldg:DataGridGroupConfiguration.StatFunctions>
                     <!-- Any source property can be used when calculating the result of the count function. -->
                     <sldg:CountFunction ResultPropertyName="GROUP_PERSONCOUNT"
                                            SourcePropertyName="FirstName" />

                    </sldg:DataGridGroupConfiguration.StatFunctions>

                    <sldg:DataGridGroupConfiguration.FixedFooters>
                       <DataTemplate>
                          <sldg:StatRow x:Name="parentElement">
                             <sldg:StatCell FieldName="FirstName"
                                            ResultPropertyName="GROUP_PERSONCOUNT">
                                <sldg:StatCell.ContentTemplate>
                                   <DataTemplate>
                                      <StackPanel Orientation="Horizontal">
                                         <TextBlock Text="{Binding ElementName=parentElement,
                                                                                   Path=(sldg:DataGridControl.GroupContext).GroupValue,
                                                                                   StringFormat='{}The {0} age group contains '}" />
                                           <!-- The StatContext is set on the StatRow and can be accessed from the DataTemplate by
                                                   using and ElementName binding. Obviously, this implies that the parent StatRow has an
                                                   explicitly defined name.  

                                                   Unlike the GroupContext, which exposes its various properties directly, the StatContext exposes 
                                                   its dynamically created properties through an indexer. -->  
                                         <TextBlock Text="{Binding ElementName=parentElement, 
                                                                                   Path=(sldg:DataGridControl.StatContext)[GROUP_PERSONCOUNT].Value, 
                                                                                   StringFormat='{}{0} people'}"/>                                                       
                                      </StackPanel>
                                   </DataTemplate>
                                </sldg:StatCell.ContentTemplate>
                             </sldg:StatCell>
                          </sldg:StatRow>
                       </DataTemplate>
                    </sldg:DataGridGroupConfiguration.FixedFooters>
                 </sldg:DataGridGroupConfiguration>
              </sldg:DataGridGroupDescription.GroupConfiguration>
           </sldg:DataGridGroupDescription>
        </sldg:DataGridControl.GroupDescriptions>
   
        <sldg:DataGridControl.StatFunctions>
           <!-- Any source property can be used when calculating the result of the count function. -->
           <sldg:CountFunction ResultPropertyName="TOTALPERSONCOUNT"
                               SourcePropertyName="FirstName" />
           <sldg:MedianFunction ResultPropertyName="MEDIANAGE"
                                SourcePropertyName="Age" />
        </sldg:DataGridControl.StatFunctions>

        <sldg:DataGridControl.FixedFooters> 
           <sldg:StatRow>
              <sldg:StatCell FieldName="FirstName"
                                    ResultPropertyName="TOTALPERSONCOUNT"
                                    ResultConverterParameter="{}{0} people in total" />                         
           </sldg:StatRow>
           <TextBlock Text="{Binding RelativeSource={RelativeSource Self},
                                                     Path=(sldg:DataGridControl.StatContext)[MEDIANAGE].Value,
                                                     StringFormat='The median age is {0}'}" />
        </sldg:DataGridControl.FixedFooters>
   
        <sldg:DataGridControl.Columns>
           <sldg:Column FieldName="FirstName"
                        Title="First Name" />
           <sldg:Column FieldName="LastName"
                        Title="Last Name" />
           <sldg:Column FieldName="Age" />
           <sldg:Column FieldName="Birthday"/>
           <sldg:Column FieldName="HasChildren"
                        Title="Children"
                        VisiblePosition="99">                   
              <!-- This DataTemplate will automatically be applied as the corresponding StatCell's content template. -->
              <sldg:Column.CellContentTemplate>
                 <DataTemplate>
                    <CheckBox IsChecked="{Binding}" />
                 </DataTemplate>
              </sldg:Column.CellContentTemplate>
           </sldg:Column>
        </sldg:DataGridControl.Columns>
   </sldg:DataGridControl>
</Grid>
Requirements

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

See Also

Reference

DataGridGroupConfiguration Class
DataGridGroupConfiguration Members

Manipulating Data

Statistical Functions

Send Feedback