Skip to main content

BaseEdit.EditValue Property

Gets or sets the editor’s value. This is a dependency property.

Namespace: DevExpress.Xpf.Editors

Assembly: DevExpress.Xpf.Core.v24.1.dll

NuGet Package: DevExpress.Wpf.Core

Declaration

public object EditValue { get; set; }

Property Value

Type Description
Object

An object that is the editor’s value.

Remarks

The EditValue property contains an editor’s current value which is valid. If an end-user has entered an invalid value, it is not posted to EditValue until it is corrected.

By default, each time the EditValue property’s value is changed, the following events are raised:

  • BaseEdit.Validate - This event is raised before the editor’s value is changed, and enables you to specify whether the editor’s value is valid, and whether the editor is allowed to lose focus. To disable validation, set the BaseEdit.CausesValidation property to false.
  • BaseEdit.EditValueChanged - Occurs after the edit value has been validated and changed. For instance, when an end-user types within a TextEdit, this event is raised each time the text is changed.

If the BaseEdit.ValidateOnTextInput property is set to false, the text entered by the end-user is posted to the EditValue after the ENTER key has been pressed or the editor has lost focus. To obtain the text entered by the end-user, do the following:

private void Window_Loaded(object sender, RoutedEventArgs e) {
    ((TextBox)textedit1.EditCore).AddHandler(TextBox.TextInputEvent, 
        new TextCompositionEventHandler(MainWindow_PreviewTextInput), true);
}

void MainWindow_PreviewTextInput(object sender, TextCompositionEventArgs e) {
    textblock1.Text = ((TextBox)textedit1.EditCore).Text;
}

Note

When using a range track bar (TrackBarEdit), allowing a range of values to be specified, use its TrackBarEdit.SelectionStart and TrackBarEdit.SelectionEnd properties to specify the range. The editor’s BaseEdit.EditValue property returns a TrackBarEditRange object.

Note

For the SpinEdit:

If you try to set the BaseEdit.EditValue property to a new value that exceeds the SpinEdit.MinValue and SpinEdit.MaxValue range, the BaseEdit.EditValue property will store the last valid value.

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.

See Also