How to: Add Virtual Rows Using the UnboundSource Component

A data-aware control bound to a data source can require additional items to display. Such items, which are shown by a control but not stored within its underlying data source, are called virtual or unbound rows. This example demonstrates how to implement such rows using the UnboundSource component.

Virtual rows are frequently needed when working with lookup editors - these often need to display service items like "All" or "None" in their drop-down lists. So start with adding the UnboundSource component and LookUpEdit control onto your form.

Use the UnboundSource component to provide data for your lookup editor. The entire process is explained in this article. Below is a brief description of what you will need to do.

Prepare an external data set. For this sample application you can use a List structure populated with simple entities as shown below.

Call the component's SetRowCount method to specify how many items your lookup should display. Typically, you would use the actual data set row count as the method's parameter. Since we need multiple additional rows, use a higher value as shown below.