'宣言 Public Enum SummaryUIType Inherits System.Enum
public enum SummaryUIType : System.Enum
メンバ | 解説 |
---|---|
Default | Default は MultiSelectForNumericsOnly に解決されます。 |
MultiSelect | ユーザーはフィールドあたりに複数の集計を追加することを許可されます。 |
MultiSelectForNumericsOnly | このオプションがフィールドあたり複数の集計を許可することを除き、SingleSelectForNumericsOnly と同じです。 |
SingleSelect | ユーザーが UI を介してフィールドあたりに追加できる集計はひとつだけです。これによってコードを介してフィールドあたり複数の集計を追加できなくなることに注意してください。 |
SingleSelectForNumericsOnly | このオプションは数値列に限り集計 UI を有効にします。String や DateTime などのデータ型には、Minimum、Maximum などの限られた集計のサブセットのみが有効です。たとえば、Average、Sum などは適用できません。このオプションは、数値タイプのフィールドの集計 UI のみを表示する方法です。 |
SummaryUIType は FieldSettings.SummaryUIType プロパティの指定に使用します。実際にユーザー インターフェイスを有効にするには、FieldSettings.AllowSummaries プロパティを設定します。
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
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}"; }