SPREAD for WPF 3.0J - GcSpreadGrid
LayoutTemplate クラス
メンバ  使用例 

GrapeCity.Windows.SpreadGrid 名前空間 : LayoutTemplate クラス
GcSpreadGrid の行の各セルの表示位置を定義します。レイアウトテンプレートには次の2つの部分が含まれます。RowTemplateCells 領域の行に使用され、ColumnHeaderTemplateColumnHeader 領域の行に使用されます。レイアウトテンプレートに含まれるのは、セルの位置やセルの結合などのレイアウト情報だけです。セルの外観やデータ情報の定義には使用できません。
オブジェクト モデル
LayoutTemplate クラスTemplateColumnDefinitionCollection クラスTemplateColumnDefinition クラスRowTemplate クラスRowTemplate クラス
シンタックス
'宣言
 
Public Class LayoutTemplate 
public class LayoutTemplate 
使用例
次のサンプルは GcSpreadGrid をデータソースにバインドさせ、すべてのデータを複数行で表示させます。
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;

LayoutTemplate template1 = new LayoutTemplate();
template1.ColumnDefinitions.Add(new TemplateColumnDefinition() {Width = 80});
template1.ColumnDefinitions.Add(new TemplateColumnDefinition() {Width = 120});

//Set row template's layout 
template1.RowTemplate = new RowTemplate();
template1.RowTemplate.RowCount = 2;
template1.RowTemplate.Cells.Add(new CellTemplate() {DataColumnName = "Name", ColumnIndex = 0, RowIndex = 0, RowSpan = 2});
template1.RowTemplate.Cells.Add(new CellTemplate() {DataColumnName = "Country", ColumnIndex = 1, RowIndex = 0});
template1.RowTemplate.Cells.Add(new CellTemplate() {DataColumnName = "City", ColumnIndex = 1, RowIndex = 1});

//set column header template's layout
template1.ColumnHeaderTemplate = new RowTemplate();
template1.ColumnHeaderTemplate.RowCount = 1;
template1.ColumnHeaderTemplate.Cells.Add(new CellTemplate() {DataColumnName = "Name", ColumnIndex = 0, RowIndex = 0});
template1.ColumnHeaderTemplate.Cells.Add(new CellTemplate() {DataColumnName = "City", ColumnIndex = 1, RowIndex = 0});

gcSpreadGrid1.LayoutTemplate = template1;
gcSpreadGrid1.LayoutMode = LayoutMode.Template;
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 template1 As New LayoutTemplate()
template1.ColumnDefinitions.Add(New TemplateColumnDefinition() With { _
.Width = 80 _
})
template1.ColumnDefinitions.Add(New TemplateColumnDefinition() With { _
.Width = 120 _
})

'Set row template's layout 
template1.RowTemplate = New RowTemplate()
template1.RowTemplate.RowCount = 2
template1.RowTemplate.Cells.Add(New CellTemplate() With { _
.DataColumnName = "Name", _
.ColumnIndex = 0, _
.RowIndex = 0, _
.RowSpan = 2 _
})
template1.RowTemplate.Cells.Add(New CellTemplate() With { _
.DataColumnName = "Country", _
.ColumnIndex = 1, _
.RowIndex = 0 _
})
template1.RowTemplate.Cells.Add(New CellTemplate() With { _
.DataColumnName = "City", _
.ColumnIndex = 1, _
.RowIndex = 1 _
})

'set column header template's layout
template1.ColumnHeaderTemplate = New RowTemplate()
template1.ColumnHeaderTemplate.RowCount = 1
template1.ColumnHeaderTemplate.Cells.Add(New CellTemplate() With { _
.DataColumnName = "Name", _
.ColumnIndex = 0, _
.RowIndex = 0 _
})
template1.ColumnHeaderTemplate.Cells.Add(New CellTemplate() With { _
.DataColumnName = "City", _
.ColumnIndex = 1, _
.RowIndex = 0 _
})

gcSpreadGrid1.LayoutTemplate = template1
gcSpreadGrid1.LayoutMode = LayoutMode.Template
継承階層

System.Object
   GrapeCity.Windows.SpreadGrid.LayoutTemplate

参照

LayoutTemplate メンバ
GrapeCity.Windows.SpreadGrid 名前空間