Ticket Q238860
Visible to All Users

Detect scroll to top/bottom

created 15 years ago

Hi,
I was wondering what's the best way to implement the following:
I add x amount of items to a collection that's bound to a XtraGrid and center the displayed row to the row/cell with the mean value of the collection via gridview.MakeRowVisible().
I'd like to add additional items to the collection whenever the client reaches the top or bottom when scrolling, so it appears like it's a virtual grid (scrolling is only allowed via mouse wheel in my grid), when in reality additional items are added to the collection "on-demand" only.
Thanks,
Tom

Comments (3)
DevExpress Support Team 15 years ago

    Hi Tom,
    To achieve your goal handle the TopRowChanged event on the following manner:

    C#
    private void gridView1_TopRowChanged(object sender, EventArgs e) { Text = string.Empty; int rowCount = gridView1.DataRowCount; this.BeginInvoke(new MethodInvoker(delegate { FireMyEvent(rowCount); })); } void FireMyEvent(int rowCount) { if (gridView1.IsRowVisible(0) == RowVisibleState.Visible) MyMethod(false); if (gridView1.IsRowVisible(rowCount - 1) == RowVisibleState.Visible) MyMethod(true); } void MyMethod(bool bottom) { /// }

    Attached is a sample project, illustrating this approach. Please review it, and inform me whether it meets your requirements.
    Thanks
    Dimitros

      Perfect, this works great! Thanks

        solved

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.