Back to Devexpress

SpreadsheetCustomCellEditEventArgs.ValueObject Property

wpf-devexpress-dot-xpf-dot-spreadsheet-dot-spreadsheetcustomcellediteventargs-a7ca86aa.md

latest4.7 KB
Original Source

SpreadsheetCustomCellEditEventArgs.ValueObject Property

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

Namespace : DevExpress.Xpf.Spreadsheet

Assembly : DevExpress.Xpf.Spreadsheet.v25.2.dll

NuGet Package : DevExpress.Wpf.Spreadsheet

Declaration

csharp
public ValueObject ValueObject { get; }
vb
Public ReadOnly Property ValueObject As ValueObject

Property Value

TypeDescription
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.

View Example

csharp
spreadsheetControl.CustomCellEdit += spreadsheetControl1_CustomCellEdit;
    // ...
private void spreadsheetControl1_CustomCellEdit(object sender, 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")
    {
        // Create a SpinEdit in-place editor and assign it to a cell. 
        SpinEditSettings settings = new SpinEditSettings();
        settings.MinValue = 1;
        settings.MaxValue = 1000;
        settings.IsFloatValue = false;
        e.EditSettings = settings;
    }
}
vb
AddHandler spreadsheetControl.CustomCellEdit, AddressOf spreadsheetControl1_CustomCellEdit
    ' ...
Private Sub spreadsheetControl1_CustomCellEdit(ByVal sender As Object, ByVal e As 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
        ' Create a SpinEdit in-place editor and assign it to a cell. 
        Dim settings As New SpinEditSettings()
        settings.MinValue = 1
        settings.MaxValue = 1000
        settings.IsFloatValue = False
        e.EditSettings = settings
    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

Custom Cell In-place Editors

SpreadsheetCustomCellEditEventArgs Class

SpreadsheetCustomCellEditEventArgs Members

DevExpress.Xpf.Spreadsheet Namespace