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

各セルの表示位置を定義するために LayoutTemplate を使用するかどうかを指定する値を取得または設定します。
構文
'Declaration
 
Public Property LayoutMode As LayoutMode
public LayoutMode LayoutMode {get; set;}

プロパティ値

LayoutTemplate を使用するかどうかを指定する LayoutMode 値。
次のサンプルは 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
参照

GcSpreadGrid クラス
GcSpreadGrid メンバ

 

 


Copyright © 2012 GrapeCity inc. All rights reserved.