バージョン

AllowSummaries プロパティ

ユーザーがフィールド値で実行するひとつまたは複数の集計計算を選択することに対して、集計計算選択 UI を有効に設定するかどうかを指定します。
シンタックス
'宣言
 
Public Property AllowSummaries As Nullable(Of Boolean)
public Nullable<bool> AllowSummaries {get; set;}
解説

AllowSummaries は集計計算選択 UI を有効にします。集計アイコンはフィールド ラベル内に表示されます。注: 使用されるテーマに基づいて、フィールド ラベル上にマウスをホバーする時にアイコンが表示される場合があります。アイコンがクリックされると、フィールドで実行する集計計算のタイプを選択するための UI を表示します。計算された集計結果は集計レコード内に表示されます。集計結果はデフォルトで、レコード コレクションの最後の集計レコードに表示されますが、FieldSettings の SummaryDisplayArea プロパティを設定して、集計結果を表示するかどうか、またどこに表示するかを制御できます。

また SummaryUIType プロパティは、集計選択 UI によりユーザーがフィールド当たり集計を 1 つしか選択できないかどうか、また集計選択 UI が数値フィールドでのみ有効になっているかどうかを制御するオプションを提供します(SummaryUIType 列挙型の SingleSelectForNumericsOnly オプションおよび MultiSelectForNumericsOnly オプションを参照)。

コードで集計計算を実行するよう指定するには、FieldLayout の プロパティを使用します。また、ユーザーが集計を選択すると、このコレクションはユーザーが選択した集計を反映して修正されます。

使用例
Note that the following code assumes there is a XamDataGrid or XamDataPresenter by the name of _dp defined.
Private Sub Window1_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
    ' Set the data source.
    _dp.DataSource = _dataSource

    ' AllowSummaries enables the UI for the user to be able to select/unselect
    ' summaries for fields. SummaryUIType specifies whether the user is allowed to
    ' select single or multiple summaries pereach field. It also has options for
    ' enabling summary selection UI for numeric fields only or for all fields.
    ' 
    _dp.FieldSettings.AllowSummaries = True
    _dp.FieldSettings.SummaryUIType = SummaryUIType.MultiSelect

    ' To add a summary, use the SummaryDefinitions property of the FieldLayout.
    ' Each SummaryDefinition object represents a summary calculation to perform
    ' on a field's data. SourceFieldName specifies the field whose data will be
    ' summarized. Key is optional and it simply associates an identifier to the
    ' summary. This identifier can be used later to access the summary via 
    ' indexers of SummaryDefinitionCollection and SummaryResultCollection. 
    ' Calculator specifies the type of calculation to perform on the field data. 
    ' There are five built in calculators of Average, Sum, Minimum, Maximum and 
    ' Count. However you can easily add custom calculators by deriving from 
    ' SummaryCalculator base class and registering the new calculator using the 
    ' SummaryCalculator's Register static method. 
    ' 
    Dim summaryDef1 As SummaryDefinition = _dp.FieldLayouts(0).SummaryDefinitions.Add( _
        "PriceAverage", SummaryCalculator.Average, "Price")

    ' StringFormat specifies the format that will be used to format the summary 
    ' result.
    ' 
    summaryDef1.StringFormat = "Avg={0:C}"

    ' Add a second summary.
    Dim summaryDef2 As SummaryDefinition = _dp.FieldLayouts(0).SummaryDefinitions.Add( _
        "PriceTotal", SummaryCalculator.Sum, "Price")

    summaryDef2.StringFormat = "Total={0:C}"
End Sub
Note that the following code assumes there is a XamDataGrid or XamDataPresenter by the name of _dp defined.
public void Window1_Loaded( object sender, RoutedEventArgs e )
{
	// Set the data source.
	_dp.DataSource = _dataSource;

	// AllowSummaries enables the UI for the user to be able to select/unselect
	// summaries for fields. SummaryUIType specifies whether the user is allowed to
	// select single or multiple summaries pereach field. It also has options for
	// enabling summary selection UI for numeric fields only or for all fields.
	// 
	_dp.FieldSettings.AllowSummaries = true;
	_dp.FieldSettings.SummaryUIType = SummaryUIType.MultiSelect;

	// To add a summary, use the SummaryDefinitions property of the FieldLayout.
	// Each SummaryDefinition object represents a summary calculation to perform
	// on a field's data. SourceFieldName specifies the field whose data will be
	// summarized. Key is optional and it simply associates an identifier to the
	// summary. This identifier can be used later to access the summary via 
	// indexers of SummaryDefinitionCollection and SummaryResultCollection. 
	// Calculator specifies the type of calculation to perform on the field data. 
	// There are five built in calculators of Average, Sum, Minimum, Maximum and 
	// Count. However you can easily add custom calculators by deriving from 
	// SummaryCalculator base class and registering the new calculator using the 
	// SummaryCalculator's Register static method. 
	// 
	SummaryDefinition summaryDef1 = _dp.FieldLayouts[0].SummaryDefinitions.Add( 
		"PriceAverage", SummaryCalculator.Average, "Price" );

	// StringFormat specifies the format that will be used to format the summary 
	// result.
	// 
	summaryDef1.StringFormat = "Avg={0:C}";

	// Add a second summary.
	SummaryDefinition summaryDef2 = _dp.FieldLayouts[0].SummaryDefinitions.Add(
		"PriceTotal", SummaryCalculator.Sum, "Price" );

	summaryDef2.StringFormat = "Total={0:C}";
}
        <igDP:XamDataGrid x:Name="_dp" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >

            
<igDP:XamDataGrid.FieldSettings>
                
<!--
                    AllowSummaries enables the UI for the user to be able to select/unselect summaries for fields.
                    SummaryUIType specifies whether the user is allowed to select single or multiple summaries per
                    each field. It also has options for enabling summary selection UI for numeric fields only or 
                    for all fields.
                
-->
                
<igDP:FieldSettings AllowSummaries="true" SummaryUIType="MultiSelect" />
            
</igDP:XamDataGrid.FieldSettings>

            
<igDP:XamDataGrid.FieldLayouts>
                
<igDP:FieldLayout IsDefault="true" >
                    
<!--
                        Use FieldLayout's SummaryDefinitions collection to add summaries.
                    
-->
                    
<igDP:FieldLayout.SummaryDefinitions>
                        
<!--
                            Each SummaryDefinition object represents a summary calculation to perform on a field's data.
                            SourceFieldName specifies the field whose data will be summarized. 
                            
                            Key is optional and it simply associates an identifier to the summary. This identifier can
                            be used later to access the summary via indexers of SummaryDefinitionCollection and 
                            SummaryResultCollection.
                            
                            Calculator specifies the type of calculation to perform on the field data. There are five
                            built in calculators of Average, Sum, Minimum, Maximum and Count. You can easily add custom
                            calculators by deriving from SummaryCalculator base class and registering the new calculator
                            using the SummaryCalculator's Register static method.
                            
                            StringFormat specifies the format that will be used to format the summary result.
                        
-->
                        
<igDP:SummaryDefinition Key="PriceAverage" SourceFieldName="Price" Calculator="Average" StringFormat="{}Avg={0:C}" />
                        
<igDP:SummaryDefinition Key="PriceTotal" SourceFieldName="Price" Calculator="Sum"  StringFormat="{}Total={0:C}" />
                    
</igDP:FieldLayout.SummaryDefinitions>
                
</igDP:FieldLayout>
            
</igDP:XamDataGrid.FieldLayouts>

        
</igDP:XamDataGrid>
参照