Skip to main content

Obtaining Values in Display and Edit Modes

  • 2 minutes to read

Display Mode

When the editor is not focused, it is in the Display mode.

The BaseEdit.EditValue property contains the editor’s current value as an object whose type can vary widely. The TextEditBase.Text property contains the text representation of the BaseEdit.EditValue property. The BaseEdit.DisplayText property contains the text that is displayed by the editor in Display mode.

See the example below:

<Window x:Class="DisplayMode.MainWindow"
        Title="MainWindow" Height="350" Width="525" xmlns:dxe="">
        <dxe:TextEdit HorizontalAlignment="Center" Name="textEdit1" VerticalAlignment="Center" Width="150"  
                      MaskType="Numeric" Mask="c2" MaskUseAsDisplayFormat="True" >
        <Label Height="85" HorizontalAlignment="Center" Name="label1" VerticalAlignment="Bottom" />
using System.Windows;

namespace DisplayMode
    public partial class MainWindow : Window
        public MainWindow()
            label1.Content = "textEdit1.EditValue = " + textEdit1.EditValue + ";\n" + 
                             "textEdit1.Text = " + textEdit1.Text + ";\n" + 
                             "textEdit1.DisplayText = " + textEdit1.DisplayText;

text properties

Edit Mode

When the editor is focused, it is in the Edit mode. In this mode, the end-user can change the editor’s value manually. The changes made by the end-user are posted to the BaseEdit.EditValue only after the Input Validation succeeds; otherwise, the BaseEdit.EditValue property contains its previous valid value.

The BaseEdit.EditCore property can be used to obtain the text that is displayed by the editor in the Edit mode. For example, to obtain the text that is displayed by the TextEdit in the Edit mode, use the following code:

string editModeText = ((TextBox)textEdit1.EditCore).Text;

Note that, by default, in edit mode, the type of the object returned by the BaseEdit.EditCore property depends on the editor type. This property contains a control specified by the BaseEdit.EditTemplate property. The table below shows the corresponding types of BaseEdit.EditCore property values for specific editor types, by default.

Editor Type BaseEdit.EditCore Type
TextEdit TextBox
ListBoxEdit DevExpress.Xpf.Editors.Popups.EditorListBox
ComboBoxEdit TextBox