Back to Devexpress

RepositoryItemLookUpEdit.SearchMode Property

windowsforms-devexpress-dot-xtraeditors-dot-repository-dot-repositoryitemlookupedit-87b76e29.md

latest8.4 KB
Original Source

RepositoryItemLookUpEdit.SearchMode Property

Gets or sets whether to immediately apply the found value to the editor as a user types a query, or only highlight the found value in the drop-down window.

Namespace : DevExpress.XtraEditors.Repository

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue(SearchMode.AutoFilter)]
[DXCategory("Behavior")]
public SearchMode SearchMode { get; set; }
vb
<DXCategory("Behavior")>
<DefaultValue(SearchMode.AutoFilter)>
Public Property SearchMode As SearchMode

Property Value

TypeDefaultDescription
SearchModeAutoFilter

A SearchMode enumeration value that specifies the search mode.

|

Available values:

NameDescription
OnlyInPopup

The incremental search is enabled only when the dropdown window is open. If the window is closed, the user can modify the text in the edit box. However these changes are ignored.

When the dropdown is open the incremental search is performed against the column whose index is specified by the RepositoryItemLookUpEdit.AutoSearchColumnIndex property. The header of this column contains the search icon (binoculars). The user can click a specific column header to perform the search against this column.

| | AutoComplete |

Enables the automatic completion feature. In this mode, when the dropdown is closed, the text in the edit box is automatically completed if it matches a RepositoryItemLookUpEditBase.DisplayMember field value of one of dropdown rows. When the dropdown is open, the automatic completion feature is disabled but the editor allows you to perform an incremental search in the same manner as when SearchMode.OnlyInPopup mode is active. The found value is immediately applied to the editor as a user types a query.

| | AutoFilter |

Enables the incremental filtering feature. When you type within the edit box, the editor automatically opens the dropdown window and displays only records whose RepositoryItemLookUpEditBase.DisplayMember field value starts with the characters typed. Other records are not displayed. If you enter a value that does not match any record, the dropdown window will not contain any rows.

The found value is immediately applied to the editor as a user types a query.

| | AutoSuggest |

The editor fires the AutoSuggest event that you should handle to assign an asynchronous Task. The task must check the user text currently entered into the editor’s text box, and return a list of matching items. This list is then assigned to the editor’s DataSource property.

| | AutoSearch |

The editor unlocks its text box and allows users to type in text. Data source records that match this text are shown in the drop-down panel. The user must highlight the required row to select a new value.

Refer to the following help topic for more information: AutoSearch Mode.

|

Remarks

The code below shows how to enable the OnlyInPopup mode, specify the column for search, allow users to change it, and enable case sensitive queries.

csharp
using DevExpress.XtraEditors.Controls;

lookUpEdit1.Properties.SearchMode = SearchMode.OnlyInPopup;
lookUpEdit1.Properties.AutoSearchColumnIndex = 1;
lookUpEdit1.Properties.HeaderClickMode = HeaderClickMode.AutoSearch;
lookUpEdit1.Properties.CaseSensitiveSearch = true;
vb
Imports DevExpress.XtraEditors.Controls;

lookUpEdit1.Properties.SearchMode = SearchMode.OnlyInPopup
lookUpEdit1.Properties.AutoSearchColumnIndex = 1
lookUpEdit1.Properties.HeaderClickMode = HeaderClickMode.AutoSearch
lookUpEdit1.Properties.CaseSensitiveSearch = True

The following code snippets (auto-collected from DevExpress Examples) contain references to the SearchMode 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-lookupedit-bind-to-simple-data-types/CS/LookupEdit-StandardBinding/Form1.cs#L38

csharp
// the text in the edit box is automatically completed if it matches a DisplayMember field value of one of dropdown rows.
riLookup.SearchMode = DevExpress.XtraEditors.Controls.SearchMode.AutoComplete;
// Specify the column against which an incremental search is performed in SearchMode.AutoComplete and SearchMode.OnlyInPopup modes

how-to-use-the-processnewvalue-event-of-a-lookup-editor-e285/CS/Form1.cs#L38

csharp
LookUpEdit1.Properties.SearchMode = DevExpress.XtraEditors.Controls.SearchMode.OnlyInPopup;
LookUpEdit1.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;

winforms-lookupedit-bind-to-simple-data-types/VB/LookupEdit-StandardBinding/Form1.vb#L40

vb
' the text in the edit box is automatically completed if it matches a DisplayMember field value of one of dropdown rows.
riLookup.SearchMode = DevExpress.XtraEditors.Controls.SearchMode.AutoComplete
' Specify the column against which an incremental search is performed in SearchMode.AutoComplete and SearchMode.OnlyInPopup modes

how-to-use-the-processnewvalue-event-of-a-lookup-editor-e285/VB/Form1.vb#L39

vb
LookUpEdit1.Properties.ValidateOnEnterKey = True
LookUpEdit1.Properties.SearchMode = DevExpress.XtraEditors.Controls.SearchMode.OnlyInPopup
LookUpEdit1.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard

See Also

TextEditStyle

SearchMode

PopupFilterMode

PopupFilter

RepositoryItemLookUpEdit Class

RepositoryItemLookUpEdit Members

DevExpress.XtraEditors.Repository Namespace