Skip to main content

CalcEdit Class

Allows you to edit numeric values using a dropdown calculator.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v23.2.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DefaultBindingPropertyEx("Value")]
public class CalcEdit :
    PopupBaseEdit

The following members return CalcEdit objects:

Remarks

The CalcEdit control allows you to edit numerical values. Using the dropdown calculator, you can perform basic calculations such as addition, multiplication, getting the inverse number and working with a memory register etc.

CalcEdit

Use the editor’s CalcEdit.Properties property to customize the editor. This provides settings controlling the editor’s style, text editing and value precision, etc.

The CalcEdit.Value and CalcEdit.EditValue properties can be used to specify the value for the calc editor. CalcEdit.Value accepts only decimal values while CalcEdit.EditValue accepts any object. CalcEdit.Value just returns the result of the conversion of the edit value to a System.Decimal type.

When the focus is moved to another control or the Enter key is pressed in the edit box (if the RepositoryItemTextEdit.ValidateOnEnterKey property is set to true), the editor converts the edit value to the Decimal type and assigns the result of the conversion back to the edit value.

The calc editor enables you to enter any text (including alpha symbols) in the edit box. This changes the control’s edit value (text displayed in the edit box is merely a text representation of the edit value). Before opening the dropdown, the edit value is converted to a decimal value and the dropdown calculator works with the result of this conversion.

If the value evaluated using the dropdown calculator is accepted, it is assigned to the CalcEdit.EditValue property. Otherwise, the old value is retained. The RepositoryItemPopupBase.CloseUp topic describes how the dropdown can be closed while accepting or discarding the selected value.

To disable text editing within the edit box, you can set the RepositoryItemButtonEdit.TextEditStyle property to TextEditStyles.DisableTextEditor.

Entering Numeric Values

See the following topic to learn about the editors you can use to enter numeric values: How to: Enter numeric values.

Inheritance

See Also