Xceed.Silverlight.DataGrid.v2.0 Assembly > Xceed.Silverlight.DataGrid Namespace > DataGridControl Class : StatFunctions Property |
'Declaration Public ReadOnly Property StatFunctions As StatFunctionCollection
'Usage Dim instance As DataGridControl Dim value As StatFunctionCollection value = instance.StatFunctions
public StatFunctionCollection StatFunctions {get;}
<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>
Target Platforms: Windows 7, Windows Vista, Windows XP SP3, Windows Server 2008 family