Welcome to the Xceed Community | Help
Community Search  
More Search Options

Custom statistical-result layout

Sort Posts: Previous Next
  •  10-08-2008, 4:08 PM Post no. 28142

    Custom statistical-result layout

    The following example demonstrates how to create a custom data template that will be used in the footers of the first-level groups to display the results of various statistical functions.

    <Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid">
      <Grid.Resources>
        <xcdg:DataGridCollectionViewSource x:Key="cvs_orderdetails"
                                           Source="{Binding Source={x:Static Application.Current},
                                                            Path=OrderDetails}">

        <xcdg:DataGridCollectionViewSource.StatFunctions>
           <xcdg:CountFunction ResultPropertyName="orderid_count"
                               SourcePropertyName="OrderID"/>
           <xcdg:SumFunction ResultPropertyName="unitprice_sum"
                             SourcePropertyName="UnitPrice"/>
           <xcdg:AverageFunction ResultPropertyName="unitprice_average"
                                 SourcePropertyName="UnitPrice"/>
           <xcdg:SumFunction ResultPropertyName="quantity_sum"
                             SourcePropertyName="Quantity"/>
         </xcdg:DataGridCollectionViewSource.StatFunctions>       

          <xcdg:DataGridCollectionViewSource.GroupDescriptions>
            <xcdg:DataGridGroupDescription PropertyName="ProductID"/>
          </xcdg:DataGridCollectionViewSource.GroupDescriptions>
        </xcdg:DataGridCollectionViewSource>

       <xcdg:StatResultConverter x:Key="valueConverter"/>

      </Grid.Resources>

      <xcdg:DataGridControl x:Name="OrderDetailsGrid"
                            ItemsSource="{Binding Source={StaticResource cvs_orderdetails}}">
        <xcdg:DataGridControl.DefaultGroupConfiguration>
          <xcdg:GroupConfiguration>
            <xcdg:GroupConfiguration.Footers>
              <xcdg:GroupHeaderFooterItemTemplate VisibleWhenCollapsed="True">
                <DataTemplate>
                  <Border realsrc="#999999" background="http://dev.xceed.xcd/kb/admin/#999999"
                          BorderBrush="LightBlue"
                          BorderThickness="3"
                          Margin="5" >
                    <Grid>
                      <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                      </Grid.ColumnDefinitions>
                      <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                      </Grid.RowDefinitions>
                      <TextBlock Text="Total Orders: " Grid.Row="0" Grid.Column="0"/>

                       <TextBlock Text="{Binding RelativeSource={RelativeSource Self},
                                                 Path=(xcdg:DataGridControl.StatContext).orderid_count}"
                                  Grid.Row="0" Grid.Column="1"/>                   
                        <TextBlock Text="Total Quantity Sold: " Grid.Row="1" Grid.Column="0"/>

                       <TextBlock Text="{Binding RelativeSource={RelativeSource Self},
                                       Path=(xcdg:DataGridControl.StatContext).quantity_sum}"
                                       Grid.Row="1" Grid.Column="1"/> 
                        <TextBlock Text="Total Sales: " Grid.Row="2" Grid.Column="0"/>

                       <TextBlock Text="{Binding RelativeSource={RelativeSource Self},

    View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.