Skip to main content

How to: Specify an Editor for a Column

The following example shows how to specify a HyperLinkEdit control as an editor for a column in the main View of XtraGrid.

First we create a corresponding repository item and add it to the internal collection of repository items specified by the EditorContainer.RepositoryItems property.

Then the repository item is assigned to the column via the GridColumn.ColumnEdit property.

The image below demonstrates a grid control to which this code is applied:

Specifying column editor Example

    RepositoryItemHyperLinkEdit repHyperLink = new RepositoryItemHyperLinkEdit();
    gridControl1.RepositoryItems.Add(repHyperLink);
    (gridControl1.MainView as GridView).Columns["EMAIL"].ColumnEdit = repHyperLink;
    //customize the editor
    repHyperLink.LinkColor = Color.Maroon
    repHyperLink.Caption = "Click to e-mail"