Back to Devexpress

RepositoryItemTextEdit.NullValuePrompt Property

windowsforms-devexpress-dot-xtraeditors-dot-repository-dot-repositoryitemtextedit-7b5e9755.md

latest6.7 KB
Original Source

RepositoryItemTextEdit.NullValuePrompt Property

Gets or sets a grayed out hint displayed when the editor’s value is null or empty. This property is in effect for standalone editors and for editors embedded in toolbars and Ribbon controls. Not supported for in-place editors embedded in grid and tree list controls. Not supported for read-only editors.

Namespace : DevExpress.XtraEditors.Repository

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Behavior")]
public virtual string NullValuePrompt { get; set; }
vb
<DXCategory("Behavior")>
Public Overridable Property NullValuePrompt As String

Property Value

TypeDefaultDescription
StringSystem.String.Empty

A string that specifies the text displayed grayed out when the edit value is empty.

|

Remarks

Use the NullValuePrompt property to display a hint in an editor when its value is not set.

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

Use the RepositoryItem.NullText property to present the editor’s null value with custom text.

csharp
textEdit1.Properties.NullText = "<empty>";
vb
textEdit1.Properties.NullText = "<empty>"

The following table compares these two properties in more detail.

|

|

NullValuePrompt property

|

NullText property

| | --- | --- | --- | |

Supported editors

|

  • Standalone editors

  • Editors embedded in toolbars and Ribbon

Note: Editors embedded in grid and treelist controls do not support the NullValuePrompt.

|

All in-place and standalone editors

| |

Conditions, when the property’s text is displayed.

|

For any editor, when its edit value equals :

For DateEdit, when its value is:

|

For any editor, when its edit value equals :

  • null

  • System.DBNull.Value

For DateEdit, when its value is:

| |

Read-only editors

|

NullValuePrompt is hidden in read-only editors

|

NullText is displayed in read-only editors

| |

Focused editors

|

NullValuePrompt keeps displaying when an editor is focused in certain cases, provided that the RepositoryItemTextEdit.ShowNullValuePrompt option equals EditorFocused. See this topic to learn more.

|

NullText is automatically hidden when an editor is focused

| |

Text color

|

SystemColors.GrayText

|

The foreground color specified by the RepositoryItem.Appearance property.

| |

The editor’s Text property.

|

The NullValuePrompt property doesn’t affect the editor’s BaseEdit.Text property.

|

The NullText property’s value, when displayed, affects the editor’s BaseEdit.Text property.

|

The SearchControl displays the default “Enter text to search…” string even if you have not set the NullValuePrompt property manually. To hide this text, assign a whitespace character to the NullValuePrompt property.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the NullValuePrompt 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#L19

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

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

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

See Also

EditValue

NullText

ShowNullValuePrompt

RepositoryItemTextEdit Class

RepositoryItemTextEdit Members

DevExpress.XtraEditors.Repository Namespace