HOME PAGE | DOWNLOAD | TUTORIALS | XtraReports
Devexpress

Saturday, July 14, 2012

XtraGrid - Embed Editors into Grid Cells

In this lesson, I’ll demonstrate how to assign the in-place editors supplied in the XtraEditors library to Grid Columns and Card fields.
1.       First, I’m going to assign editors to some card fields.
2.       To do this, I select the Card View, and in this case select the “Order Date” and the “Required Date” card fields.
3.       To select multiple card fields like this, I can use the shift key.
4.       Then, I’ll select the column edit property, and assign a “Date Edit” in-place editor.
5.       This editor enables date/time values to be edited using a drop-down calendar.
6.       The created in-place editor is represented by the repository item that stores the editor’s properties and event handlers.
7.       Using those settings, the repository item is capable of creating fully functional editors which are ready to be used to edit cell values.
8.       After the “Date Edit” repository item has been created, I can access its settings. For example, I can specify a range of available values.
9.       Now, I’ll select the “Advanced Banded Grid View” to assign in-place editor to the county and address columns.
10.   First, I select the “Country” column, modify the “ColumnEdit” property, and assign the “Combo Box Edit” to it.
11.   After the Combo Box Editor has been created, I can access its items collection and populate it with the countries that will be displayed within the drop-down.
12.   When assigning in-place editors to columns and card fields, the corresponding repository items are automatically added to the Grid Control’s internal repository.
13.   So, it’s also possible to create and customize the repository items and then assign them to grid columns.
14.   This is what I’m going to demonstrate.
15.   I run the designer, and switch to the “In-place Editor Repository” page.
16.   The repository items that I created before I listed here.
17.   Now, I’ll add a new repository item.
18.   Let it be the “Memo E X Edit”.
19.   Then, I switch to the columns page, and assign the “Memo E X Edit” I just created to the Address column.
20.   And I’m done.
21.   I close the designer, and run the project to see the result.
22.   I can click the cells, and the view automatically creates editors to enable me to edit cell values.
23.   The editors are created based on the settings of the corresponding repository items.

Enhanced by Zemanta

No comments:

Post a Comment