- 4 minutes to read
The Vertical Grid Control (VGridControl) allows you to represent underlying data using different formats - layouts. Layouts differ in the number of records they display at a time and in the way they are arranged. This topic demonstrates how to change a layout and briefly explains the differences between each layout. Each layout is described in detail in its own separate topic (links are provided).
The PropertyGridControl supports only one layout, which is equivalent to the Single Record View Layout used in the Vertical Grid Control. The Property Grid Control does not support horizontal scrolling.
How to Change the Layout
The layout currently applied to a VGridControl control is specified by its VGridControl.LayoutStyle property. The image below demonstrates how the layout can be changed at design time.
The same can also be done in code:
As can be seen from the above image there are three different layout styles which can be applied to a vertical grid control. These layout styles are listed below:
When this layout is applied to the control, a single record is displayed at a time. If there are too many fields to fit into the control’s area then the records are arranged into columns - bands. This layout is likely to be used if you have a large number of fields to display and want them all to be visible within a grid.
This layout also displays a single record at a time. The difference with the Bands View layout is that the record isn’t arranged into columns if it exceeds the control’s height. Row headers together with record values occupy the entire grid’s width. This layout is likely to be useful if you need to display only a small number of fields and you want to disable standard navigation through records (custom navigation can be implemented). For instance, a single record from the data source can be displayed to each user (e.g. the users of your application can see only their details unless they have extended permissions).
Apply this layout to the control to display multiple records within a grid. This type of layout is likely to be useful if you need to display only a small number of fields and want to provide easy navigation through the records to your end-users.
Scrolling through Records in Different Layouts
Basically, there are three ways in which end-users can navigate through records: using the left and right arrow keys, the mouse wheel or the horizontal scrollbar. However, not all of these navigation methods are supported by each type of layout. The list below describes the methods that are available for scrolling through the records in each layout and explains how they can be enabled or disabled, as well as providing information on how each navigation method works with each particular layout style.
- Moving focus from record to record using the left and right arrow keys. The table below shows how this type of navigation depends upon the layout applied.
|Bands View Layout||Key navigation through the records is disabled. Left and right arrow keys are used to navigate through the bands in this case.|
|Single Record View Layout||Key navigation is enabled only when the horizontal scrollbar is displayed.|
|Multiple Records View Layout||Key navigation through the records is always enabled.|
- Moving focus from record to record using the mouse wheel. For this purpose the VGridOptionsBehavior.RecordsMouseWheel option must be enabled. This option can be accessed via the VGridControlBase.OptionsBehavior property.
- Scrolling through the records using the horizontal scrollbar.
Navigation through the records in Bands View and Single Record View layout is allowed if the horizontal scrollbar is shown. Otherwise, end-users cannot navigate through the records. The horizontal scrollbar’s visibility is specified by the VGridControlBase.ScrollVisibility property.