Back to Devexpress

BaseEdit.EditValue Property

wpf-devexpress-dot-xpf-dot-editors-dot-baseedit-f09cf1c6.md

latest9.9 KB
Original Source

BaseEdit.EditValue Property

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

Namespace : DevExpress.Xpf.Editors

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

NuGet Package : DevExpress.Wpf.Core

Declaration

csharp
public object EditValue { get; set; }
vb
Public Property EditValue As Object

Property Value

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

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

wpf-synchronous-theme-preload-with-splashscreen/CS/ThemePreloadwithSplashscreen/ComplexWindow.xaml#L44

xml
<dxlc:LayoutItem AddColonToLabel="True" Label="First Name">
    <dxe:TextEdit EditValue="{Binding Path=FirstName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />
</dxlc:LayoutItem>

wpf-data-grid-implement-crud-operations/CS/CodeBehind/EFCore/ServerMode/IssueDetailView.xaml#L12

xml
<dxlc:LayoutItem Label="User">
    <dxe:ComboBoxEdit EditValue="{Binding Item.UserId}" ItemsSource="{Binding EditOperationContext.Users}"
                      ValueMember="Id" DisplayMember="Name"

reporting-wpf-print-listview-data/CS/Window1.xaml#L54

xml
</Grid.ColumnDefinitions>
<dxe:TextEdit Grid.Row="0" Grid.Column="0" EditValue="GUID" Style="{StaticResource headerTextStyle}" />
<dxe:TextEdit Grid.Row="0" Grid.Column="1" EditValue="Date" Style="{StaticResource headerTextStyle}" />

wpf-svgimagesource-extension-specify-vector-image-as-glyph/CS/DXSample/MainWindow.xaml#L19

xml
BarItemDisplayMode="ContentAndGlyph"
           GlyphSize="{Binding ElementName=sizeEditor, Path=EditValue}"/>
<dxb:BarButtonItem Content="Notebook"

wpf-scheduler-specify-custom-edit-and-recurrence-dialogs/CS/CustomMvvmFormWithRecurrenceExample/HospitalAppointmentWindow.xaml#L37

xml
<dxlc:LayoutItem Label="Patient name:">
    <dxe:TextEdit x:Name="subjectEdit" EditValue="{Binding Subject, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />
</dxlc:LayoutItem>

dxrichedit-for-wpf-how-to-implement-progress-indicator/CS/MyProgressIndicator.cs#L43

csharp
_Indicator.Maximum = maxProgress;
_Indicator.EditValue = currentProgress;
_Indicator.Visibility = System.Windows.Visibility.Visible;

wpf-richedit-use-docvariable-fields/CS/MyProgressIndicator.cs#L33

csharp
_Indicator.Maximum = maxProgress;
_Indicator.EditValue = currentProgress;
_Indicator.Visibility = System.Windows.Visibility.Visible;

wpf-pivot-grid-define-custom-cell-template-to-performing-data-editing/CS/HowToEditCell/PivotGridEditHelper.cs#L139

csharp
if(edit.EditValue != null && decimal.TryParse(edit.EditValue.ToString(), out newValue)) {
    if (item.Value == null || !decimal.TryParse(item.Value.ToString(), out oldValue))

wpf-pivot-grid-implement-a-custom-filter-popup/CS/DXPivotGrid_CustomFilterPopup/CustomFilterEdit.cs#L44

csharp
this.EditValue = editValue;
this.EndDataUpdate();

dxrichedit-for-wpf-how-to-implement-progress-indicator/VB/MyProgressIndicator.vb#L41

vb
_Indicator.Maximum = maxProgress
_Indicator.EditValue = currentProgress
_Indicator.Visibility = System.Windows.Visibility.Visible

wpf-richedit-use-docvariable-fields/VB/MyProgressIndicator.vb#L32

vb
_Indicator.Maximum = maxProgress
_Indicator.EditValue = currentProgress
_Indicator.Visibility = System.Windows.Visibility.Visible

wpf-pivot-grid-define-custom-cell-template-to-performing-data-editing/VB/HowToEditCell/PivotGridEditHelper.vb#L147

vb
If edit.EditValue IsNot Nothing AndAlso Decimal.TryParse(edit.EditValue.ToString(), newValue) Then
    If item.Value Is Nothing OrElse Not Decimal.TryParse(item.Value.ToString(), oldValue) Then

wpf-pivot-grid-implement-a-custom-filter-popup/VB/DXPivotGrid_CustomFilterPopup/CustomFilterEdit.vb#L53

vb
Me.EditValue = editValue_Renamed
Me.EndDataUpdate()

See Also

EditValueChanged

Validate

CausesValidation

BaseEdit Class

BaseEdit Members

DevExpress.Xpf.Editors Namespace