GrapeCity SPREAD for WPF 2.0J
GroupDescriptions プロパティ

GcSpreadGrid の Rows のグループ化方法を記述する SpreadGroupDescription オブジェクトのコレクションを取得します。
構文
'Declaration
 
Public ReadOnly Property GroupDescriptions As SpreadGroupDescriptionCollection
public SpreadGroupDescriptionCollection GroupDescriptions {get;}

プロパティ値

GcSpreadGrid の Rows のグループ化方法を記述する SpreadGroupDescription オブジェクトのコレクション。
次のサンプルは GcSpreadGrid をデータソースに連結し、表示されたデータを「Country」列でグループ化します。
List<Customer> list = new List<Customer>();
list.Add(new Customer() { Name = "Nancy", Country = "Japan", City = "Tokyo" });
list.Add(new Customer() { Name = "Janet", Country = "Japan", City = "Sendai", });
list.Add(new Customer() { Name = "Rose", Country = "Japan", City = "Tokyo", });
list.Add(new Customer() { Name = "Buchanan", Country = "Japan", City = "Osaka", });
list.Add(new Customer() { Name = "Leverling", Country = "Japan", City = "Tokyo", });
list.Add(new Customer() { Name = "Gavin", Country = "China", City = "Beijing", });
list.Add(new Customer() { Name = "Victoria", Country = "China", City = "Xi'An", });
list.Add(new Customer() { Name = "Apple", Country = "China", City = "Beijing", });
list.Add(new Customer() { Name = "Tim", Country = "China", City = "Beijing", });
list.Add(new Customer() { Name = "John", Country = "China", City = "Xi'An", });

gcSpreadGrid1.ItemsSource = list;

Column column1 = gcSpreadGrid1.Columns["Country"];
GroupCell headerCell = column1.GroupHeader[0, 0];
headerCell.ColumnSpan = int.MaxValue;
headerCell.Background = Brushes.Azure;
headerCell.Formula = @"GroupInfo(""groupBy"") & "": "" & GROUPINFO(""groupText"")";

column1.GroupFooter.RowCount = 1;
column1.GroupFooter.Rows[0].Background = Brushes.LightBlue;
GroupCell footerCell1 = column1.GroupFooter[0, 0];
footerCell1.Value = "Count: ";
footerCell1.ColumnSpan = gcSpreadGrid1.ColumnCount - 1;
GroupCell footerCell2 = column1.GroupFooter[0, gcSpreadGrid1.ColumnCount - 1];
footerCell2.AggregationType = AggregationType.Count;

SpreadGroupDescription groupDescription = new SpreadGroupDescription();
groupDescription.ColumnName = "Country";
gcSpreadGrid1.GroupDescriptions.Add(groupDescription);
Dim list As New List(Of Customer)()
list.Add(New Customer() With { _
    .Name = "Nancy", _
    .Country = "Japan", _
    .City = "Tokyo" _
})
list.Add(New Customer() With { _
    .Name = "Janet", _
    .Country = "Japan", _
    .City = "Sendai" _
})
list.Add(New Customer() With { _
    .Name = "Rose", _
    .Country = "Japan", _
    .City = "Tokyo" _
})
list.Add(New Customer() With { _
    .Name = "Buchanan", _
    .Country = "Japan", _
    .City = "Osaka" _
})
list.Add(New Customer() With { _
    .Name = "Leverling", _
    .Country = "Japan", _
    .City = "Tokyo" _
})
list.Add(New Customer() With { _
    .Name = "Gavin", _
    .Country = "China", _
    .City = "Beijing" _
})
list.Add(New Customer() With { _
    .Name = "Victoria", _
    .Country = "China", _
    .City = "Xi'An" _
})
list.Add(New Customer() With { _
    .Name = "Apple", _
    .Country = "China", _
    .City = "Beijing" _
})
list.Add(New Customer() With { _
    .Name = "Tim", _
    .Country = "China", _
    .City = "Beijing" _
})
list.Add(New Customer() With { _
    .Name = "John", _
    .Country = "China", _
    .City = "Xi'An" _
})

gcSpreadGrid1.ItemsSource = list

Dim column1 As Column = gcSpreadGrid1.Columns("Country")
Dim headerCell As GroupCell = column1.GroupHeader(0, 0)
headerCell.ColumnSpan = Integer.MaxValue
headerCell.Background = Brushes.Azure
headerCell.Formula = "GroupInfo(""groupBy"") & "": "" & GROUPINFO(""groupText"")"

column1.GroupFooter.RowCount = 1
column1.GroupFooter.Rows(0).Background = Brushes.LightBlue
Dim footerCell1 As GroupCell = column1.GroupFooter(0, 0)
footerCell1.Value = "Count: "
footerCell1.ColumnSpan = gcSpreadGrid1.ColumnCount - 1
Dim footerCell2 As GroupCell = column1.GroupFooter(0, gcSpreadGrid1.ColumnCount - 1)
footerCell2.AggregationType = AggregationType.Count

Dim groupDescription As New SpreadGroupDescription()
groupDescription.ColumnName = "Country"
gcSpreadGrid1.GroupDescriptions.Add(groupDescription)
参照

GcSpreadGrid クラス
GcSpreadGrid メンバ

 

 


Copyright © 2012 GrapeCity inc. All rights reserved.