FlexPivot for WinForms
MultiColumnDictionary クラス
メンバ  使用例 

C1.Win.C1FlexGrid.4.5.2 アセンブリ > C1.Win.C1FlexGrid 名前空間 : MultiColumnDictionary クラス
Class that implements the IC1MultiColumnDictionary and can be used as a column DataMap to create multi-column combo editors.
オブジェクト モデル
MultiColumnDictionary クラス
シンタックス
'宣言
 
Public Class MultiColumnDictionary 
   Inherits System.Collections.Specialized.ListDictionary
   Implements IC1MultiColumnDictionaryIC1MultiColumnDictionary2 
public class MultiColumnDictionary : System.Collections.Specialized.ListDictionary, IC1MultiColumnDictionaryIC1MultiColumnDictionary2  
解説
The MultiColumnDictionary class can be used to implement simple string-based data maps or bound data maps that get the data from a data source object.
使用例

The code below creates an unbound two-column data map and assigns it to a grid column:

The map consists of three items, each with two columns. Because the autoKeys parameter was set to true in the map's constructor, the map will have unique integer keys for each value,and those integers will be stored in the grid cells. If autoKeys had been set to false, the strings themselves would be used as keys and stored in the grid cells.

The code below creates a bound data map and assigns it to a grid column:

This map is bound to an Employees DataTable. The keyColumn parameter is set to "EmployeeID", causing this field to be used as a key. When the grid is edited, the values stored in the cells will be the employee's ID. However, this value is never displayed be the grid.

The drop-down list will show the employee's first name, last name, and country, as specified by the columnNames parameter.

When the list is closed, the grid will display the employee's last name, as specified by the displayColumn parameter.

Note that this map is dynamically bound to the data source, so if the employees table is modified, the editor list will reflect the changes automatically.

Note also that the usual combo editing features such as auto-search and double-click cycling still work.

// create string-based MultiColumnDictionary and assign it to column
// note: this will automatically generate keys of type 'int' for each item,
// the key values will be stored in the grid.
string text = "Row1, Col1\tRow1, Col2|Row2, Col1\tRow2, Col3|Row2, Col1\tRow3, Col2";
MultiColumnDictionary map = new MultiColumnDictionary(text, 0, true);
_flex.Cols[1].DataMap = map;
// create data-based MultiColumnDictionary and assign it to column
// notes: the list will automatically be updated is the data source changes.
DataTable dt = GetDataTable("employees");
string[] columnNames = new string[] { "FirstName", "LastName", "Country" };
MultiColumnDictionary map = new MultiColumnDictionary(dt, "EmployeeID", columnNames, 1);
_flex.Cols[2].DataMap = map;
継承階層

System.Object
   System.Collections.Specialized.ListDictionary
      C1.Win.C1FlexGrid.MultiColumnDictionary

参照

MultiColumnDictionary メンバ
C1.Win.C1FlexGrid 名前空間