Skip to main content

LookUpEditBase Class

Serves as a base for classes that provide look-up functionality.

Namespace: DevExpress.Xpf.Editors

Assembly: DevExpress.Xpf.Core.v24.2.dll

NuGet Package: DevExpress.Wpf.Core

Declaration

public abstract class LookUpEditBase :
    PopupBaseEdit,
    ISelectorEdit,
    IBaseEdit,
    IInputElement

Remarks

The LookUpEditBase abstract class implements basic functionality for ComboBoxEdit and LookUpEdit controls and their descendants.

Tip

The LookUpEditBase class inherits its features from the PopupBaseEdit class.

Refer to the PopupBaseEdit class description for information on derived features and API.

Bind to Data

To bind a LookUpEditBase descendant to a data source, use its LookUpEditBase.ItemsSource property.

Tip

Refer to the ComboBoxEdit and LookUpEdit class descriptions for more information on binding them to data sources.

Update Bound Data

Set the AllowLiveDataShaping property to true to update a lookup editor when a bound data source is modified outside the lookup editor.

Calling the RefreshData() method only makes sense when a bound data source does not support the IBindingList interface. Otherwise, the control automatically updates itself, since such data sources provide data change notifications.

Performing Multiple Data Updates

LookupEdit descendants (ComboBox or LookupEdit) refresh their UI and internal state each time its data source collection is updated.

Depending on the size of your data source, the amount and frequency of updates, it may be useful to lock the control and update it after all the data is updated.

Use the BeginDataUpdate and EndDataUpdate methods to prevent the control’s internal data updates:

  • Call the BeginDataUpdate method. A data editor stops reacting on data updates.
  • Perform data updates.
  • Call the EndDataUpdate method. A data editor updates its UI to reflect all the changes.
public void PerformUpdates() {
    lookUpEdit.BeginDataUpdate();
    // Perform massive data updates...
    lookUpEdit.EndDataUpdate();
}

Related API:

Collection View Support

LookUpEditBase includes support for ICollectionViews – allowing you to manipulate the current record, and define rules for filtering, sorting, and grouping.

If the AllowCollectionView property is set to false and an ICollectionView is used as a data source, the LookUpEditBase transforms the ICollectionView to a plain list, internally. In this case, an editor ignores the rules defined for grouping via GroupDescriptions in the ICollectionView.

Set the IsSynchronizedWithCurrentItem property to true, to ensure that the edit value always corresponds to the CurrentItem property in the ICollectionView.

Selection

Select Items

To obtain a selected item, use the SelectedItem property. Each time another item is selected, an editor changes the SelectedIndex property value and raises the SelectedIndexChanged event.

If an editor works in multiselect, checked, or token operation mode, you can use the following API:

Related API:

Filtering and Searching

Filtering

If incremental filtering is enabled (the IncrementalFiltering property is set to true), end users can filter list items dynamically based upon a text typed into the edit box (find-as-you-type filtering). The FilterCondition property specifies the filter condition (the comparison operator).

If the FilterCondition property is set to FilterCondition.Default, FilterCondition.StartsWith is used.

The LookUpEdit control can filter data from an ItemSource before displaying. You can use the FilterCriteria property to set a filter expression.

Related API:

Searching

Related API:

Autocomplete

If the AutoComplete property is set to true, the text typed by an end user within the edit box is automatically completed, if it matches a value displayed within the drop down. The AutoComplete option is disabled for ComboBoxEdit, and enabled for LookUpEdit by default.

The LookUpEditBase.IsCaseSensitiveSearch property specifies whether the editor should distinguish between upper and lower case characters while looking for the matching item.

Access Individual Items

Method Description
GetDisplayValue(Int32) Returns the specified item’s display value.
GetIndexByKeyValue(Object) Returns the specified item’s index.
GetItemByKeyValue(Object) Returns an item with the specified key value.
GetKeyValue(Int32) Returns the specified item’s value.

Add New Items

If an editor cannot find an item that matches the text entered by an end user within the edit box, the ProcessNewValue event occurs. Handle this event to manually validate a new value, and add the corresponding record to a data source.

Related API:

Appearance Customization

You can define the appearance of popup items displayed in the LookUpEditBase class descendants using the ItemTemplate and ItemTemplateSelector properties.

To make a selected item look in the same way, as it looked in the editor’s popup, set the ApplyItemTemplateToSelectedItem property to true.

Related API:

End User Interaction

Set the AllowItemHighlighting property to false to disable item highlighting.

LookUpEditBase.AllowItemHighlighting

Set the ImmediatePopup property to true to make an editor display its popup right after an end user has typed a character in the edit box.

Wait Indicators

When an editor is bound to the asynchronous server mode sources, it can display loading indicators in its text area and in its popup. Use the following properties to control a visibility of editor’s wait indicators.

lookup edit base show editor wait indicator

See Also