Back to Devexpress

BarEditItem.EditValue Property

windowsforms-devexpress-dot-xtrabars-dot-baredititem-5a6ea70a.md

latest8.2 KB
Original Source

BarEditItem.EditValue Property

Gets or sets the in-place editor’s value.

Namespace : DevExpress.XtraBars

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[Browsable(true)]
[DefaultValue(null)]
public virtual object EditValue { get; set; }
vb
<Browsable(True)>
<DefaultValue(Nothing)>
Public Overridable Property EditValue As Object

Property Value

TypeDefaultDescription
Objectnull

An Object that specifies the editor’s value.

|

Remarks

To respond to changing the EditValue property, handle the BarEditItem.EditValueChanged event.

For certain in-place editors, the static WindowsFormsSettings.InplaceEditorUpdateMode property controls the time when the BarEditItem.EditValueChanged event fires - immediately or after the in-place editor loses focus. 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

The following code snippets (auto-collected from DevExpress Examples) contain references to the EditValue property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-workspacemanager-saving-load-app-layout/CS/T190543/Form1.cs#L40

csharp
this.selectWorkSpaceItem.EditValue = "Default";

winforms-spreadsheet-use-formula-engine/CS/FormulaEngineTest/Form1.cs#L22

csharp
spreadsheetControl1.Document.DocumentSettings.R1C1ReferenceStyle = true;
editExpressionStyle.EditValue = 0;

winforms-spreadsheet-load-and-save-a-password-encrypted-files/CS/EncryptionExample/Form1.cs#L29

csharp
((DevExpress.XtraEditors.Repository.RepositoryItemComboBox)(barEncryptionTypeComboBox.Edit)).Items.Add(currentValue.ToString());
    barEncryptionTypeComboBox.EditValue = DevExpress.Spreadsheet.EncryptionType.Strong.ToString();
}

winforms-dashboard-custom-items-extension/CS/CustomItemExtension/CustomItems/WebPageItem/WebPageItemExtensionModule.cs#L31

csharp
if(designer.SelectedDashboardItem is CustomDashboardItem<WebPageItemMetadata>)
        urlBarItem.EditValue = selectedCustomItem.Metadata.URI;
}

winforms-bars-create-baredititem/CS/Form1.cs#L143

csharp
item.Edit = combo;
item.EditValue = "[n/a]";
item.Width = 100;

winforms-workspacemanager-saving-load-app-layout/VB/T190543/Form1.vb#L40

vb
repositoryItemLookUpEdit1.Columns(2).Visible = False
selectWorkSpaceItem.EditValue = "Default"
workspaceManager1.CloseStreamOnWorkspaceSaving = DevExpress.Utils.DefaultBoolean.True

winforms-spreadsheet-use-formula-engine/VB/FormulaEngineTest/Form1.vb#L21

vb
spreadsheetControl1.Document.DocumentSettings.R1C1ReferenceStyle = True
editExpressionStyle.EditValue = 0

winforms-spreadsheet-load-and-save-a-password-encrypted-files/VB/EncryptionExample/Form1.vb#L30

vb
barEncryptionTypeComboBox.EditValue = EncryptionType.Strong.ToString()
End Sub

winforms-dashboard-custom-items-extension/VB/CustomItemExtension/CustomItems/WebPageItem/WebPageItemExtensionModule.vb#L37

vb
If TypeOf designer.SelectedDashboardItem Is CustomDashboardItem(Of WebPageItemMetadata) Then
    urlBarItem.EditValue = selectedCustomItem.Metadata.URI
End If

winforms-bars-create-baredititem/VB/Form1.vb#L138

vb
item.Edit = combo
item.EditValue = "[n/a]"
item.Width = 100

See Also

EditValueChanged

InplaceEditorUpdateMode

BarEditItem Class

BarEditItem Members

DevExpress.XtraBars Namespace