Back to Devexpress

BarEditItem.EditValueChanged Event

windowsforms-devexpress-dot-xtrabars-dot-baredititem-466e07c8.md

latest3.9 KB
Original Source

BarEditItem.EditValueChanged Event

Occurs when the BarEditItem.EditValue property value changes.

Namespace : DevExpress.XtraBars

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public event EventHandler EditValueChanged
vb
Public Event EditValueChanged As EventHandler

Event Data

The EditValueChanged event's data class is EventArgs.

Remarks

Cast the sender event parameter to the BarEditItem type to identify the item whose value has been changed. To get the new value, read the BarEditItem.EditValue property.

For certain in-place editors, the WindowsFormsSettings.InplaceEditorUpdateMode static setting specifies when a BarEditItem raises the EditValueChanged event - after the editor loses focus (default), or with each change made in the in-place editor. See WindowsFormsSettings.InplaceEditorUpdateMode to learn more.

Example

The following code shows how to:

  • embed a SpinEdit editor in a bar using the BarEditItem object.
  • assign an initial value to the editor (BarEditItem);
  • handle the BarEditItem.EditValueChanged event to perform actions when the editor’s value changes.

csharp
private void Form1_Load(object sender, EventArgs e) {
    // Create a BarEditItem with embedded SpinEdit in-place editor.
    BarEditItem item = new BarEditItem(barManager1);
    item.Edit = barManager1.RepositoryItems.Add("SpinEdit");
    bar1.AddItem(item);
    item.EditValueChanged += BarEditItem1_EditValueChanged;

    // Specify the editor's initial value.
    int initialValue = 0;
    item.EditValue = initialValue;
}

// Perform actions when the editor's value changes
private void BarEditItem1_EditValueChanged(object sender, EventArgs e) {
    BarEditItem item = sender as BarEditItem;
    object newValue = item.EditValue;
    //...
}
vb
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    ' Create a BarEditItem with embedded SpinEdit in-place editor.
    Dim item As BarEditItem = New BarEditItem(BarManager1)
    item.Edit = BarManager1.RepositoryItems.Add("SpinEdit")
    Bar1.AddItem(item)
    AddHandler item.EditValueChanged, AddressOf BarEditItem1_EditValueChanged

    ' Specify the editor's initial value.
    Dim initialValue As Integer = 0
    item.EditValue = initialValue
End Sub

' Perform actions when the editor's value changes
Private Sub BarEditItem1_EditValueChanged(sender As Object, e As EventArgs)
    Dim item As BarEditItem = CType(sender, BarEditItem)
    Dim newValue As Object = item.EditValue
    '...
End Sub

See Also

EditValue

InplaceEditorUpdateMode

BarEditItem Class

BarEditItem Members

DevExpress.XtraBars Namespace