RepositoryItemMRUEdit.ValidateOnEnterKey Property
Gets or sets a value specifying whether to invoke the RepositoryItem.Validating event when pressing the ENTER key.
Namespace: DevExpress.XtraEditors.Repository
Assembly: DevExpress.XtraEditors.v24.1.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
[DefaultValue(true)]
[DXCategory("Behavior")]
public override bool ValidateOnEnterKey { get; set; }
Property Value
Type | Default | Description |
---|---|---|
Boolean | true | true if the RepositoryItem.Validating event is fired when the ENTER key is pressed; otherwise, false |
Remarks
If the ValidateOnEnterKey property is true (the default behavior), validation of the edit value is enabled when the end-user presses the ENTER key. Note: a value entered into the edit region of a MRU editor can only be inserted as a new item in the RepositoryItemComboBox.Items list after it has been validated by a validation procedure. So, setting ValidateOnEnterKey to true enables a new item to be inserted by pressing the ENTER key.
If the property is set to false, validating (and new item insertion) only occurs when moving focus to another control.
When validation of the edit value is required, the editor invokes the RepositoryItem.Validating event which you should handle in order to check end-user input. For instance, you can check whether the text entered only contains appropriate characters or check that a numeric value falls within a range etc. The event parameter enables you to cancel the validation and thus force the end-user to correct the value.