Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Collapse]Vertical Grid
   [Expand]Overview
   [Expand]Fundamentals
   [Collapse]Concepts
     Filtering
    [Expand]Layouts
    [Expand]Binding to Data
    [Expand]Rows
    [Collapse]Records
      Adding and Deleting Records
      Focusing and Scrolling Records
    [Expand]Cells
    [Expand]In-place Editors
     Formatting
    [Expand]Appearances
     Hit Information
    [Expand]Custom Painting
    [Expand]Alpha Blending and Background Images
    [Expand]Customization Form
     Batch Modifications
    [Expand]Drag and Drop
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]Examples
   [Expand]End-User Capabilities
   [Expand]Member Tables
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Focusing and Scrolling Records

The Vertical Grid Control (VGridControl) enables end-users to focus and scroll records using the techniques described in the Navigating Through Cells topic of the end-user Capabilities section. The same can also be performed via code. This topic explains how to implement this with respect to the layout style applied to the control and provides examples of situations in which programmatic record scrolling may be useful.

Expanded Layouts and Scrolling Records

The purpose and the way record scrolling is used depends on the layout style currently applied to the Vertical Grid Control control. When either the single record view or the bands view layout is applied to the control, a single record is displayed at a time. In this case there is no difference between scrolling through records and focusing them - focusing a record implies scrolling to it, and vice versa. Note also, that the horizontal scroll bar acts like a data navigator when any of the layouts mentioned is applied. Programmatic scrolling can be used to provide custom navigation facilities. For instance, you can disable the horizontal scroll bar using the VGridControlBase.ScrollVisibility property and provide a custom control that will be used to navigate through records. Furthermore, you can provide advanced navigation, such as scrolling to the next and previous records that satisfy a specific condition.

When the multiple records view layout is applied to the control, several records can be visible simultaneously. Thus, scrolling though records does not imply changing the record focus. However, when focusing a record the view is automatically scrolled to make it visible. In this mode programmatic scrolling and focusing can be used to facilitate end-users in finding and editing data. For instance, you may scroll the view to a specific record and row and activate the focused cell's editor so that end-users need to type a new value only. Another example can be leaving focus at a specific record while showing the desired data to the end-user. When the user presses the ENTER or SPACE keys to activate the focused cell's editor, the view is automatically scrolled back to the focused record.

Expanded Moving Focus and Scrolling

The Vertical Grid Control provides a number of members that can be used to navigate through records. The list below describes each of them in brief.

  • VGridControlBase.FocusedRecord - gets or sets the index of the focused record. The first record's index is zero. The last available record's index is the VGridControlBase.RecordCount property value decremented by one.
  • VGridControlBase.LeftVisibleRecord - gets or sets the index of the record that is currently the left visible within the view.
  • VGridControlBase.HorzScroll - when the multiple records view or single records view layout is applied, scrolls the view by the specified number of records. If the method's parameter value is negative, the view is scrolled backwards. Otherwise, the view is scrolled forward. If a bands view layout is applied, this method's behavior has peculiarities. If all bands are visible within the view, the method scrolls the view by the specified number of records. If not all bands fit the view's area, the method scrolls the view by the specified number of bands.
  • VGridControlBase.MakeRecordVisible - scrolls the view so that the specified record becomes visible. If the specified record is already visible, this method does nothing. Note that using this method when either the single record view or the bands view layout is applied is the same as assigning the desired value to the VGridControlBase.FocusedRecord or VGridControlBase.LeftVisibleRecord properties.

The image below illustrates the effect of the described members when the multiple records view layout is applied to the control.

Expanded Example of a Custom Navigation Panel

The example in this section shows how to create a custom navigation panel that is capable of moving record focus and scrolling the view horizontally. The control will be comprised of several buttons and a check box as shown in the image below:

The table below lists the elements of this navigation panel and explains their purpose. It also contains the Name property value of each control. You must set the names of the controls to those listed below when creating the panel. These names will be used later in the code sample.

Element Description
If checked, the navigation panel's buttons move focus. Otherwise, they scroll the view horizontally.
Name: chbMoveFocus.
If the check box is checked, focuses the first record. Otherwise, scrolls the view so that the first record is visible leaving the focus unchanged.
Name: btnFirst.
If the check box is checked, shifts focus backwards one record. Otherwise, scrolls the view left by one record leaving the focus unchanged.
Name: btnPrev.
Makes the focused record visible.
Name: btnShowFocused.
If the check box is checked, shifts focus forward one record. Otherwise, scrolls the view right by one record leaving the focus unchanged.
Name: btnNext.
If the check box is checked, focuses the last record. Otherwise, scrolls the view so that the last record is visible leaving the focus unchanged.
Name: btnLast.

After such a panel has been created you must handle the Click event of the button residing in it. The code below shows how this can be performed. It is assumed that the navigation panel works with the vertical grid control named vGridControl1.

After the event handlers have been written, you can run the application and test the navigation panel. Note again that the grid control must use the multiple records view layout so that you see the difference between moving focus and scrolling the view.

How would you rate this topic?​​​​​​​