Skip to main content
A newer version of this page is available. .

CalcEdit Class

Allows you to edit numeric values using a dropdown calculator.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v18.1.dll

Declaration

[ToolboxTabName("DX.18.1: Common Controls")]
[ToolboxBitmap(typeof(ToolboxIconsRootNS), "CalcEdit")]
[DefaultBindingPropertyEx("Value")]
public class CalcEdit :
    PopupBaseEdit

The following members accept/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.

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

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