Back to Devexpress

How to: Create a SearchLookUpEdit and Bind it to Data

wpf-10748-controls-and-libraries-data-editors-getting-started-how-to-create-a-searchlookupedit-and-bind-it-to-data.md

latest1.9 KB
Original Source

How to: Create a SearchLookUpEdit and Bind it to Data

  • Aug 03, 2020
  • 3 minutes to read

The SearchLookUpEdit editor combines the functionality of the LookUpEdit with the built-in Find box feature that allows you to quickly locate data.

This document demonstrates how to create a SearchLookUpEdit control and bind it to data.

Create a New Project and Add a SearchLookUpEdit

  1. Run MS Visual Studio.

  2. Create a new WPF Application project. For this, choose New Project on the File menu or press Ctrl+Shift+N , and then choose the WPF Application.

  3. Add a LookUpEdit component to the project.

  4. To enable the Find box feature, set the StyleSettings property to “SearchLookUpEditStyleSettings”:

Create Data Objects

Add a data source to your WPF Application. For this, follow the steps below.

  1. Open the Data menu and click the Add New Data Source item.

  2. Choose a Database as a type of a data source.

  3. Then choose a Dataset as a Database Model.

  4. As a data source, choose the Microsoft Access Database File. As a data connection, choose the nwind database. By default, it is stored in the following path.C:\Users\Public\Documents\DevExpress Demos 25.2\Components\Data

  5. In the Tables menu, choose Customers.

  6. After this, click Finish to close the wizard.

Bind SearchLookUpEdit to Data

  1. Bind the SearchLookUpEdit to the data source. Add the following code.

  2. To disable automatic column creation, set the AutoPopulateColumns property to “False”. Create required columns and bind them to corresponding data fields:

  3. Run the application to see the result.