Back to Devexpress

RepositoryItemTextEdit.NullValuePromptShowForEmptyValue Property

windowsforms-devexpress-dot-xtraeditors-dot-repository-dot-repositoryitemtextedit-8dc59553.md

latest7.1 KB
Original Source

RepositoryItemTextEdit.NullValuePromptShowForEmptyValue Property

Gets or sets whether the editor displays a prompt when its value is not specified (equals String.Empty).

Namespace : DevExpress.XtraEditors.Repository

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual bool NullValuePromptShowForEmptyValue { get; set; }
vb
<Browsable(False)>
<EditorBrowsable(EditorBrowsableState.Never)>
Public Overridable Property NullValuePromptShowForEmptyValue As Boolean

Property Value

TypeDefaultDescription
Booleanfalse

true if the editor displays a prompt when its value is not specified (equals String.Empty); otherwise, false.

|

Remarks

The editor can display a prompt when its value is not specified. Use the NullValuePrompt property to specify the prompt.

csharp
textEdit1.Properties.NullValuePrompt = "Enter text to search...";
vb
textEdit1.Properties.NullValuePrompt = "Enter text to search..."

The ShowNullValuePrompt property provides access to the following flags that specify when the prompt is shown:

  • EmptyValue — the prompt is displayed when the editor’s value equals String.Empty or null ( Nothing in VB). Disable this option to only display the prompt when the editor’s value equals null ( Nothing in VB).
  • EditorReadOnly — the prompt is displayed when the editor is in the read-only and editable states. Disable this option to only display the prompt when the editor is editable.
  • EditorFocused — the prompt is displayed when the editor is focused and not focused. Disable this option to only display the prompt when the editor is not focused.

The prompt disappears when the user clicks the focused editor or starts to enter a value. The prompt does not appear again if the user clears the entered value.

You can specify the flags in the Properties window.

The snippet below shows how to specify the flags in code.

csharp
textEdit1.Properties.ShowNullValuePrompt =
    ShowNullValuePromptOptions.EditorFocused | ShowNullValuePromptOptions.EmptyValue;
vb
textEdit4.Properties.ShowNullValuePrompt =
    ShowNullValuePromptOptions.EditorFocused Or ShowNullValuePromptOptions.EmptyValue

Note

Since version 19.2, all options are enabled — the default value is Default. For previous versions, all options are disabled — the default value is NullValue.

See Version Compatibility: Default Property Values for more information about changes introduced in specific versions.

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

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.

winforms-mvvm-best-practices/CS/POCOBindableProperties/StandardDataBindingUserControl.cs#L20

csharp
editor.Properties.NullValuePrompt = "Please, enter the Title here...";
editor.Properties.NullValuePromptShowForEmptyValue = true;

winforms-scheduler-sync-google-event-colors-with-labels/CS/SchedulerGSync/SchedulerGSync/SyncOptionsForm.cs#L15

csharp
Service = service;
this.lookUpEdit1.Properties.NullValuePromptShowForEmptyValue = false;
this.lookUpEdit1.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.False;

winforms-mvvm-best-practices/VB/POCOBindableProperties/StandardDataBindingUserControl.vb#L20

vb
editor.Properties.NullValuePrompt = "Please, enter the Title here..."
editor.Properties.NullValuePromptShowForEmptyValue = True

winforms-scheduler-sync-google-event-colors-with-labels/VB/SchedulerGSync/SchedulerGSync/SyncOptionsForm.vb#L18

vb
Me.Service = service
Me.lookUpEdit1.Properties.NullValuePromptShowForEmptyValue = False
Me.lookUpEdit1.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.False

See Also

NullValuePrompt

ShowNullValuePrompt

RepositoryItemTextEdit Class

RepositoryItemTextEdit Members

DevExpress.XtraEditors.Repository Namespace