Skip to main content

BaseEdit.DefaultErrorIcon Property

Gets or sets the default error icon.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DXCategory("Appearance")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static Image DefaultErrorIcon { get; set; }

Property Value

Type Description
Image

A Image object that specifies the default error icon.

Remarks

You can display an error icon next to the editor to indicate that the editor’s value is not valid. The default Default Error Icon icon is displayed to the left of the editor. Use the static (Shared in VB) DefaultErrorImageOptions property to access the following options that allow you to customize the default icon:

  • Image — a custom raster image used as an error icon. The icon’s size must be 12x12 pixels. This property is equivalent to the DefaultErrorIcon property.
  • Alignment — an alignment relative to the editor. This property is equivalent to the DefaultErrorIconAlignment property.

Update these properties before the editor is initialized. You can also use the ErrorImageOptions property to access the same options that allow you to customize the error icon for an individual editor:

  • Image — a custom raster image used as an error icon. This property is equivalent to the ErrorIcon property.
  • Alignment — an alignment relative to the editor. This property is equivalent to the ErrorIconAlignment property.

The icon is shown if an error message is assigned to the ErrorText property. The error message is displayed in a tooltip that appears when the mouse pointer hovers over the icon.

Error Icon

Tip

Use the ErrorText property to display an icon with a tooltip next to a stand-alone editor. If you use an editor in a data-aware control, use the control’s following events to validate an editor’s value and display an error icon: BaseView.ValidatingEditor, TreeList.ValidatingEditor, and VGridControlBase.ValidatingEditor.

If an editor value is invalid (the error icon and text are shown), users can press “Esc” to clear the ErrorText and revert the editor back to its OldEditValue. To disable this default behavior, handle the KeyPress event:

txtNewNote.KeyPress += TxtNewNote_KeyPress;

private void TxtNewNote_KeyPress(object sender, KeyPressEventArgs e) {
    MemoEdit edit = sender as MemoEdit;
    if (e.KeyChar == (char)Keys.Escape && !string.IsNullOrEmpty(edit.ErrorText))
        e.Handled = true;
}
See Also