Home Forums WinForms controls Xceed Grid for WinForms How to bring a grid element into view

Viewing 1 post (of 1 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #17823 |

    Each element in the grid can be brought to view using the BringIntoView method. This method will ensure that the grid element is brought into view no matter its state or its parent state. For example, if the grid element is in a collapsed group, the group will be expanded and the grid scrolled (if necessary) so that the grid element is made visible. The FirstVisibleRow and FirstVisibleColumn properties allow you to change the first/last visible row or column. Setting these properties will automatically bring the newly affected row or column into view. When setting the CurrentCell, CurrentColumn or CurrentRow properties as well as when calling the MoveCurrentCell, MoveCurrentRow and MoveCurrentColumn methods, the BringIntoView method must be called if you want to bring the new current object into view.

    The following examples demonstrates how to bring various grid elements into view. Keep in mind that although the examples mostly use rows located within the grid’s DataRows, any other type of row, located in any section of the grid or group (i.e., FixedHeaderRows, FooterRows, etc.) can be brought into view in the same manner.

    VB.NET

    GridControl1.Groups( GridControl1.Groups.Count – 1 ).BringIntoView()

    GridControl1.FirstVisibleRow = GridControl1.DataRows( GridControl1.DataRows.Count – 1 )
    GridControl1.FirstVisibleColumn = GridControl1.Columns( GridControl1.Columns.Count – 1 )

    GridControl1.CurrentCell = GridControl1.DataRows( GridControl1.DataRows.Count – 1 ).Cells( GridControl1.Columns.Count – 1 )

    GridControl1.CurrentCell.BringIntoView()

    GridControl1.CurrentColumn = GridControl1.Columns( gridControl1.Columns.Count – 1 )
    GridControl1.CurrentColumn.BringIntoView()

    GridControl1.CurrentRow = GridControl1.DataRows( gridControl1.DataRows.Count – 1 )
    GridControl1.CurrentRow.BringIntoView()

    C#

    gridControl1.Groups[ gridControl1.Groups.Count – 1 ].BringIntoView();

    gridControl1.FirstVisibleRow = gridControl1.DataRows[ gridControl1.DataRows.Count – 1 ];
    gridControl1.FirstVisibleColumn = gridControl1.Columns[ gridControl1.Columns.Count – 1 ];

    gridControl1.CurrentCell = gridControl1.DataRows[ gridControl1.DataRows.Count – 1 ].Cells[ gridControl1.Columns.Count – 1 ];

    gridControl1.CurrentCell.BringIntoView();

    gridControl1.CurrentColumn = gridControl1.Columns[ gridControl1.Columns.Count – 1 ];
    gridControl1.CurrentColumn.BringIntoView();

    gridControl1.CurrentRow = gridControl1.DataRows[ gridControl1.DataRows.Count – 1 ];
    gridControl1.CurrentRow.BringIntoView();

    Imported from legacy forums. Posted by Xceed admin (had 2641 views)

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.