Xceed DataGrid for Silverlight Documentation
StatCell Class
Members  Example 


Represents a cell that is contained in a StatRow and in which the results of statistical functions are displayed.
Object Model
StatCell ClassColumn ClassRow Class
Syntax
'Declaration
 
<TemplateVisualStateAttribute(Name="GridHeader", GroupName="LocationStates")>
<TemplateVisualStateAttribute(GroupName="ResultStates", Name="IsDefinite")>
<TemplateVisualStateAttribute(GroupName="LocationStates", Name="GridFooter")>
<TemplateVisualStateAttribute(GroupName="LocationStates", Name="GroupHeader")>
<TemplateVisualStateAttribute(GroupName="LocationStates", Name="GroupFooter")>
<TemplateVisualStateAttribute(GroupName="ResultStates", Name="IsEstimate")>
Public Class StatCell 
   Inherits Cell
   Implements MS.Internal.IManagedPeer, MS.Internal.IManagedPeerBase, MS.Internal.INativeCoreTypeWrapper, Xceed.Silverlight.DragDrop.IProvideDraggedContentPresenter 
'Usage
 
Dim instance As StatCell
[TemplateVisualStateAttribute(Name="GridHeader", GroupName="LocationStates")]
[TemplateVisualStateAttribute(GroupName="ResultStates", Name="IsDefinite")]
[TemplateVisualStateAttribute(GroupName="LocationStates", Name="GridFooter")]
[TemplateVisualStateAttribute(GroupName="LocationStates", Name="GroupHeader")]
[TemplateVisualStateAttribute(GroupName="LocationStates", Name="GroupFooter")]
[TemplateVisualStateAttribute(GroupName="ResultStates", Name="IsEstimate")]
public class StatCell : Cell, MS.Internal.IManagedPeer, MS.Internal.IManagedPeerBase, MS.Internal.INativeCoreTypeWrapper, Xceed.Silverlight.DragDrop.IProvideDraggedContentPresenter  
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>
Inheritance Hierarchy

System.Object
   System.Windows.DependencyObject
      System.Windows.UIElement
         System.Windows.FrameworkElement
            System.Windows.Controls.Control
               System.Windows.Controls.ContentControl
                  Xceed.Silverlight.DataGrid.ContentControlBase
                     Xceed.Silverlight.DataGrid.Cell
                        Xceed.Silverlight.DataGrid.StatCell

Requirements

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

See Also

Reference

StatCell Members
Xceed.Silverlight.DataGrid Namespace

Manipulating Data

Statistical Functions

Send Feedback