Skip to main content
A newer version of this page is available. .

SpreadsheetCustomCellEditEventArgs.ValueObject Property

Gets a value associated with the CustomCellInplaceEditor object assigned to the cell.

Namespace: DevExpress.XtraSpreadsheet

Assembly: DevExpress.XtraSpreadsheet.v19.1.dll

Declaration

public ValueObject ValueObject { get; }

Property Value

Type Description
ValueObject

A ValueObject object associated with the custom cell editor.

Remarks

If you use the CustomCellInplaceEditorCollection.Add method to embed a custom in-place editor of a particular type in a cell or cell range and assign a ValueObject to it, you can handle the SpreadsheetControl.CustomCellEdit event and use the event’s ValueObject parameter to: (1) Identify the custom editor associated with the given ValueObject to adjust the editor’s properties – or (2) Assign a specific editor to the affected cells if the editor of the CustomCellInplaceEditorType.Custom type has been used.

The second approach is shown in the example below.

    spreadsheetControl.CustomCellEdit += spreadsheetControl1_CustomCellEdit;
    // ...

// Create a repository item corresponding to a SpinEdit control
RepositoryItemSpinEdit repository = new RepositoryItemSpinEdit();
private void spreadsheetControl1_CustomCellEdit(object sender, DevExpress.XtraSpreadsheet.SpreadsheetCustomCellEditEventArgs e)
{
    // Specify a type of the custom editor assigned to cells of the "Quantity" table column.
    // To identify the custom editor, use a value of ValueObject associated with it. 
    if (e.ValueObject.IsText && e.ValueObject.TextValue == "MySpinEdit")
    {
        //Specify the repository item settings.
        repository.AutoHeight = false;
        repository.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;

        repository.MinValue = 1;
        repository.MaxValue = 1000;
        repository.IsFloatValue = false;
        // Assign the SpinEdit editor to a cell.
        e.RepositoryItem = repository;
    }
}

If no CustomCellInplaceEditor is assigned to the processed cell or the custom cell editor doesn’t contain any ValueObject associated with it, the ValueObject property returns an empty object (the ValueObject.IsEmpty property is true).

For more information on how to embed custom in-place editors within worksheet cells, see the Custom Cell In-place Editors example.

See Also