Skip to main content

Bands View Layout

  • 4 minutes to read

This topic describes the Bands View layout which is available in the Vertical Grid Control (VGridControl). For an overview of all the layouts that can be applied to the control, see the Layouts Overview topic.

Main Features of The Bands View Layout

The image below shows a VGridControl control with the Bands view layout applied to it.

VE_Band

The features specific to this layout are listed below:

  • A single record (or part of one) is displayed at a time. End-users can navigate through the records using the horizontal scroll bar. (You can provide your users with a custom method of scrolling through records. See the Focus and Scroll Records topic for details.)
  • The control’s contents cannot be scrolled vertically. The row header cells and data cells are arranged into a number of columns that won’t exceed the grid’s height. These columns are bands.
  • Bands can either exceed the control’s width (requiring scrolling to view all the bands) or be adjusted to fit the control’s width. See Scrolling Bands below for more information.
  • end-users can resize bands by dragging the right border of the leftmost visible band.

 

The following list enumerates properties specific to this layout.

Scrolling Bands

If the grid’s BaseOptionsView.AutoScaleBands property is set to true, bands will be resized (stretched or shrunk as appropriate) to exactly occupy the grid’s entire client region. Otherwise, if the total width of the bands exceeds that of the grid’s client region and the grid’s BaseOptionsView.AutoScaleBands property is set to false some of the bands will be outside the visible area.

If a band is partially visible, end-users can make it completely visible by clicking its data cells or by scrolling through the bands using the mouse wheel if the VGridOptionsBehavior.RecordsMouseWheel property is set to false. This property can be accessed via the grid’s VGridControlBase.OptionsBehavior property.

The following sample code demonstrates how to scroll bands via code. The VGridControlBase.LeftVisibleBand property is used for this purpose. It’s assumed that there are two buttons in your application: ‘btnForward‘ and ‘btnBackward‘. These buttons scroll the bands forward and backwards, respectively. When the first or last band is reached the corresponding button is disabled. The handlers for the button clicks are listed below.

// handling a click on the Backward button 
private void btnBackward_Click(object sender, System.EventArgs e) {
   // scrolling backwards by one band
   vGridControl1.LeftVisibleBand -= 1;
   // disabling the button if the first band has been reached
   if (vGridControl1.LeftVisibleBand == 0)
      btnBackward.Enabled = false;
   // ensuring that the Forward button is enabled
   btnForward.Enabled = true;
}

// handling the Forward button click
private void btnForward_Click(object sender, System.EventArgs e) {
   // scrolling forwards by one band
   vGridControl1.LeftVisibleBand += 1;
   // disabling the button if the last band has been reached
   if (vGridControl1.LeftVisibleBand == vGridControl1.BandCount - 1)
      btnForward.Enabled = false;
   // ensuring that the Backward button is enabled
   btnBackward.Enabled = true;
}
See Also