GrapeCity MultiRow Windows Forms Documentation
ColumnHeaderCell

The column header cell can display column selection or sorting indicators.

ColumnHeaderCell

ColumnHeaderCell can only be placed in ColumnHeaderSection.

Features

In addition to the features of the HeaderCell, the following features can also be used in ColumnHeaderCell.

For more details on each feature, refer to the ColumnHeaderCell class.

For more information on data types, cell edit control, style, shortcut keys, and events, refer to HeaderCell.

Using Code

The code below shows a column header cell that selects a cell in the column header section and a column header cell that sorts a cell.

[VB]

Imports GrapeCity.Win.MultiRow

Dim template As Template = New Template()
Dim columnHeaderSection As ColumnHeaderSection = New ColumnHeaderSection()
Dim columnHeaderCell1 As ColumnHeaderCell = New ColumnHeaderCell()
Dim columnHeaderCell2 As ColumnHeaderCell = New ColumnHeaderCell()
columnHeaderCell1.Location = New Point(0, 0)
columnHeaderCell1.Value = "Select"
columnHeaderCell2.Location = New Point(columnHeaderCell1.Width, 0)
columnHeaderCell2.Value = "Sort"
columnHeaderCell2.SortCellIndex = 1
columnHeaderCell2.SelectionMode = MultiRowSelectionMode.None
columnHeaderCell2.SortMode = SortMode.Automatic
columnHeaderSection.Cells.Add(columnHeaderCell1)
columnHeaderSection.Cells.Add(columnHeaderCell2)
columnHeaderSection.Height = columnHeaderCell1.Height

Dim textBoxCell1 As TextBoxCell = New TextBoxCell()
Dim textBoxCell2 As TextBoxCell = New TextBoxCell()
textBoxCell1.Location = New Point(0, 0)
textBoxCell2.Location = New Point(textBoxCell1.Width, 0)
template.Row.Cells.Add(textBoxCell1)
template.Row.Cells.Add(textBoxCell2)

template.Row.Height = textBoxCell1.Height
template.Width = textBoxCell1.Size.Width * 2
template.ColumnHeaders.Add(columnHeaderSection)

GcMultiRow1.Template = template
GcMultiRow1.AllowUserToAddRows = False
GcMultiRow1.RowCount = 10

For i As Integer = 0 To GcMultiRow1.RowCount - 1
    GcMultiRow1.Rows(i).Cells(1).Value = i.ToString()
Next

[CS]

using GrapeCity.Win.MultiRow;

Template template = new Template();
ColumnHeaderSection columnHeaderSection = new ColumnHeaderSection();
ColumnHeaderCell columnHeaderCell1 = new ColumnHeaderCell();
ColumnHeaderCell columnHeaderCell2 = new ColumnHeaderCell();
columnHeaderCell1.Location = new Point(0, 0);
columnHeaderCell1.Value = "Select";
columnHeaderCell2.Location = new Point(columnHeaderCell1.Width, 0);
columnHeaderCell2.Value = "Sort";
columnHeaderCell2.SortCellIndex = 1;
columnHeaderCell2.SelectionMode = MultiRowSelectionMode.None;
columnHeaderCell2.SortMode = SortMode.Automatic;
columnHeaderSection.Cells.Add(columnHeaderCell1);
columnHeaderSection.Cells.Add(columnHeaderCell2);
columnHeaderSection.Height = columnHeaderCell1.Height;

TextBoxCell textBoxCell1 = new TextBoxCell();
TextBoxCell textBoxCell2 = new TextBoxCell();
textBoxCell1.Location = new Point(0, 0);
textBoxCell2.Location = new Point(textBoxCell1.Width, 0);
template.Row.Cells.Add(textBoxCell1);
template.Row.Cells.Add(textBoxCell2);

template.Row.Height = textBoxCell1.Height;
template.Width = textBoxCell1.Size.Width * 2;
template.ColumnHeaders.Add(columnHeaderSection);

gcMultiRow1.Template = template;
gcMultiRow1.AllowUserToAddRows = false;
gcMultiRow1.RowCount = 10;

for (int i = 0; i < gcMultiRow1.RowCount; i++)
{
    gcMultiRow1.Rows[i].Cells[1].Value = i.ToString();
}
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options