Skip to main content
A newer version of this page is available. .

LookUpEdit Class

The editor that provides lookup functionality using a lightweight dropdown grid.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v18.1.dll

Declaration

[ToolboxBitmap(typeof(ToolboxIconsRootNS), "LookUpEdit")]
[DefaultBindingProperty("EditValue")]
[ToolboxTabName("DX.18.1: Common Controls")]
[SmartTagAction(typeof(LookUpEditActions), "Columns", "Columns", SmartTagActionType.CloseAfterExecute)]
[SmartTagAction(typeof(LookUpEditActions), "PopulateColumns", "Populate Columns")]
public class LookUpEdit :
    LookUpEditBase

The following members accept/return LookUpEdit objects:

Remarks

A lookup editor is an editor with an embedded dropdown window, which displays lookup records (the records from which an end-user can select). When a lookup record is selected, the editor’s value (the BaseEdit.EditValue bindable property) and display text are modified accordingly.

The LookUpEdit presents lookup records as a lightweight grid control.

LookUpEditor

To present lookup records using a feature-rich GridControl, use the GridLookUpEdit or SearchLookUpEdit control instead.

To learn how to set up lookup editors in different binding modes, see the following topics:

You may want to filter the popup data source of one (secondary) lookup editor based on the value of another (primary) lookup editor. This scenario is covered in the following topic:

Additional Customization

The following list shows some of the members that help you perform the additional customization of the LookUpEdit control.

To embed a LookUpEdit in a cell within a container control (XtraGrid, XtraTreeList, etc), use the RepositoryItemLookUpEdit component. See the Repositories and Repository Items topic, for more information.

Example

This example shows how to use an in-place LookUpEdit control (RepositoryItemLookUpEdit) for editing cells in a grid column.The lookup editor in the example is used to edit the CategoryID field values from the Products list. However, instead of displaying category IDs, the editor will display corresponding category names in the edit box.The main properties used to set up the LookUpEdit control are:- DataSource - Specifies the lookup data source.- ValueMember - Specifies the field from the lookup data source whose values match the editor’s edit value.- DisplayMember - Identifies the field from the lookup data source whose values match the editor’s display text.

The following image shows the result.

lookup-standardmode-example-result.gif

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace LookupEdit_StandardBinding {
    static class Program {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main() {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
}

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

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.

See Also