Back to Devexpress

ColumnView.MoveLast() Method

windowsforms-devexpress-dot-xtragrid-dot-views-dot-base-dot-columnview-4569ea8a.md

latest5.5 KB
Original Source

ColumnView.MoveLast() Method

Moves focus to the last data record.

Namespace : DevExpress.XtraGrid.Views.Base

Assembly : DevExpress.XtraGrid.v25.2.dll

NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

csharp
public virtual void MoveLast()
vb
Public Overridable Sub MoveLast

Remarks

If the last data record (row or card) is invisible on screen, calling the MoveLast method scrolls the View to make the record visible. Note that in Grid Views, the last data row may be hidden within a collapsed group. In such cases, necessary groups are expanded to make the row visible.

End-users can focus the last data record by pressing the “Last” button of the embedded data navigator or pressing CTRL+END while the View has focus.

If you need to move focus to the last visible row (row, group row, or card), use the ColumnView.MoveLastVisible method.

In Instant Feedback Mode, the MoveLast method when called, does nothing while a grid is loading its data for the first time. If you need to move focus to the last record on the grid’s initialization, handle the ColumnView.RowLoaded event as follows:

csharp
using DevExpress.XtraGrid.Views.Base;

bool needMoveLastRow = true;
private void gridView1_RowLoaded(object sender, RowEventArgs e) {
    ColumnView view = sender as ColumnView;
    if (needMoveLastRow) {
        needMoveLastRow = false;
        view.MoveLast();
    }
}
vb
Imports DevExpress.XtraGrid.Views.Base

Private needMoveLastRow As Boolean = True
Private Sub GridView1_RowLoaded(sender As Object, e As DevExpress.XtraGrid.Views.Base.RowEventArgs) _
    Handles GridView1.RowLoaded
    Dim view As ColumnView = TryCast(sender, ColumnView)
    If needMoveLastRow Then
        needMoveLastRow = False
        view.MoveLast()
    End If
End Sub

Note

Detail pattern Views do not contain data and they are never displayed within XtraGrid. So, the MoveLast member must not be invoked for these Views. The MoveLast member can only be used with Views that display real data within the Grid Control. Use the following methods to access these Views with which an end user interacts at runtime.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the MoveLast() method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-chat-for-net-framework/CS/DevExpress.AI.WinForms.HtmlChat/ChatControl.cs#L145

csharp
if (messages.Count > 0)
        messagesItemsView.MoveLast();
}

See Also

MoveBy(Int32)

MoveFirst()

MoveLastVisible()

MoveNext()

MoveNextPage()

MovePrev()

MovePrevPage()

Rows

ColumnView Class

ColumnView Members

DevExpress.XtraGrid.Views.Base Namespace