windowsforms-devexpress-dot-xtraspreadsheet-dot-spreadsheetcustomcellediteventargs-6e6fa82d.md
Gets a value associated with the CustomCellInplaceEditor object assigned to the cell.
Namespace : DevExpress.XtraSpreadsheet
Assembly : DevExpress.XtraSpreadsheet.v25.2.dll
NuGet Package : DevExpress.Win.Spreadsheet
public ValueObject ValueObject { get; }
Public ReadOnly Property ValueObject As ValueObject
| Type | Description |
|---|---|
| ValueObject |
A ValueObject object associated with the custom cell editor.
|
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;
}
}
AddHandler spreadsheetControl.CustomCellEdit, AddressOf spreadsheetControl1_CustomCellEdit
' ...
' Create a repository item corresponding to a SpinEdit control
Dim repository As New RepositoryItemSpinEdit()
Private Sub spreadsheetControl1_CustomCellEdit(ByVal sender As Object, ByVal e As DevExpress.XtraSpreadsheet.SpreadsheetCustomCellEditEventArgs)
' 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 AndAlso e.ValueObject.TextValue = "MySpinEdit" Then
' 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
End If
End Sub
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
SpreadsheetCustomCellEditEventArgs Class