HOME PAGE | DOWNLOAD | TUTORIALS | XtraReports
Devexpress

Saturday, July 14, 2012

XtraGrid - Band and Column Customization

This lesson demonstrates the basics of working with banded Grid Views. I’ll show you to add and delete bands, customize band settings, and change the layout of bands and columns.
1.       First, let’s change the view type from GridView to “Advanced Banded Grid View”.
2.       You’ll see that all the columns are now under the default band.
3.       Let’s add one more band to break the columns up into two logical parts.
4.       For this purpose, we need to run the designer.
5.       You can add bands and specify their location at the same time by pressing the “Add New Band” button and dragging the mouse pointer to the desired band position.
6.       After you’ve added the band, you can click its header to access the band settings.
7.       In this example, we can use this feature to change the band caption.
8.       To rearrange columns between bands, I simply drag the desired columns and drop them where they are needed.
9.       Now I’m done with the layout customizations, so I’ll close the designer.
10.   The columns and bands layout can also be customized right on the form.
11.   Let’s drag columns one under another, so that the corresponding data cells are arranged to two rows.
12.   Let’s now make the grid a little bit more readable, by stretching the columns to fit the entire view.
13.   The Column’s “Auto Width View” option needs to be set to true for this particular purpose.
14.   Now we need to make the column headers in the second band, occupy two rows.
15.   To do this, we simply click the column headers (we could use the “Control” or “Shift” key to select multiple columns), and once selected, I set their “Auto Fill Down” property to true to make them stretch down automatically.
16.   Finally, let’s change the caption of the “Customer ID” column using the same approach.
17.   Now I’m done with banded column customizations, so let’s run the application to see the result.

Enhanced by Zemanta

No comments:

Post a Comment