HOME PAGE | DOWNLOAD | TUTORIALS | XtraReports
Devexpress

Sunday, July 22, 2012

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:

C#

    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"

 

VB

    Dim repHyperLink As RepositoryItemHyperLinkEdit = New RepositoryItemHyperLinkEdit
    GridControl1.RepositoryItems.Add(repHyperLink)
    CType(GridControl1.MainView, GridView).Columns(0).ColumnEdit = repHyperLink
    'customize the editor
    repHyperLink.LinkColor = Color.Maroon
    repHyperLink.Caption = "Click to e-mail"

 

No comments:

Post a Comment