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

Defining detail descriptions

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

    Defining detail descriptions

    The following example demonstrates how to explicitly define detail descriptions for the DataRelations found in the DataTable to which the grid is bound and how to calculate statistical functions for a detail description whose results will be displayed in the StatRows contained in the footer sections of the details to which the description's corresponding detail configuration will be applied.

    <Grid>
      <Grid.Resources>
         <xcdg:DataGridCollectionViewSource x:Key="cvs_employees"
                                            Source="{Binding Source={x:Static Application.Current},
                                                             Path=Employees}">

           <xcdg:DataGridCollectionViewSource.DetailDescriptions>
              <xcdg:DataRelationDetailDescription RelationName="Employee_Orders"
                                                  Title="Employee Orders">

                 <xcdg:DataRelationDetailDescription.DetailDescriptions>
                    <xcdg:DataRelationDetailDescription RelationName="Order_OrderDetails"
                                                        Title="Order Details">
                       <xcdg:DataRelationDetailDescription.ItemProperties>
                          <xcdg:DataGridItemProperty Name="UnitPrice" />
                          <xcdg:DataGridItemProperty Name="Quantity" />
                          <xcdg:DataGridItemProperty Name="Discount" />
                       </xcdg:DataRelationDetailDescription.ItemProperties>
                       <xcdg:DataRelationDetailDescription.StatFunctions>                         
                          <xcdg:SumFunction ResultPropertyName="sum_quantity"
                                            SourcePropertyName="Quantity" />
                          <xcdg:AverageFunction ResultPropertyName="average_unitprice"
                                                SourcePropertyName="UnitPrice" />
                       </xcdg:DataRelationDetailDescription.StatFunctions>
                    </xcdg:DataRelationDetailDescription>
                 </xcdg:DataRelationDetailDescription.DetailDescriptions>
              </xcdg:DataRelationDetailDescription>
           </xcdg:DataGridCollectionViewSource.DetailDescriptions>
         </xcdg:DataGridCollectionViewSource>
      </Grid.Resources>
     
      <xcdg:DataGridControl x:Name="EmployeesGrid"
                          ItemsSource="{Binding Source={StaticResource cvs_employees}}"
                          ItemsSourceName="Employee Information"
                          AutoCreateDetailConfigurations="True">

        <xcdg:DataGridControl.DetailConfigurations>
           <xcdg:DetailConfiguration RelationName="Employee_Orders">
              <xcdg:DetailConfiguration.DetailConfigurations>
                 <xcdg:DetailConfiguration RelationName="Order_OrderDetails">
                    <xcdg:DetailConfiguration.Footers>
                       <DataTemplate>
                          <xcdg:StatRow realsrc="AliceBlue" background="http://dev.xceed.xcd/kb/admin/AliceBlue">
                             <xcdg:StatCell FieldName="UnitPrice"
                                            ResultPropertyName="average_unitprice"
                                            ResultConverterParameter="f2" />
                             <xcdg:StatCell FieldName="Quantity"
                                            ResultPropertyName="sum_quantity" />                            
                          </xcdg:StatRow>
                       </DataTemplate>
                    </xcdg:DetailConfiguration.Footers>
                 </xcdg:DetailConf
    View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.