Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9153605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:18:02+00:00 2026-06-17T12:18:02+00:00

Does anyone know of a reliable approach for scrolling a WPF DataGrid (.NET 4)

  • 0

Does anyone know of a reliable approach for scrolling a WPF DataGrid (.NET 4) to the last row programmatically?

I’m aware of ScrollIntoView(Items[Items.Count-1]), but this works only if the items are unique.

For instance, consider the following DataGrid which displays all the installed cultures, followed by all the installed cultures:

var cultures = System.Globalization.CultureInfo.GetCultures (System.Globalization.CultureTypes.AllCultures);
var timesTwo = cultures.Concat (cultures).ToArray();

var grid = new DataGrid { ItemsSource = timesTwo };

How can this grid be programmatically scrolled to the last row?

P.S. Another problem with using ScrollIntoView is that if the grid is itself in a scrollable container (e.g., inside another grid), then ScrollIntoView scrolls not only its own grid, but the outer grid as well such that requested element is visible on the screen. This might be beneficial in some cases, but certainly not in others.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:18:04+00:00Added an answer on June 17, 2026 at 12:18 pm

    For anyone with this problem, the following seems to do the trick:

    var scrollerViewer = GetScrollViewer();
    if (scrollerViewer != null) scrollerViewer.ScrollToEnd();
    
    ...
    
    ScrollViewer GetScrollViewer()
    {
       if (VisualTreeHelper.GetChildrenCount (this) == 0) return null;
       var x = VisualTreeHelper.GetChild (this, 0);
       if (x == null) return null;
       if (VisualTreeHelper.GetChildrenCount (x) == 0) return null;
       return VisualTreeHelper.GetChild (x, 0) as ScrollViewer;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know a cross-browser, reliable solution for catching presses of the tab-key in
Does anyone know of a reliable, accurate library to compute the multivariate normal (MVN)
Does anyone know of any reliable (and, hopefully, extensive) books/websites that discuss GDI+ performance
Does anyone know of a reliable way to store data to use across pages
Does anyone know a reliable way to check whether the referrer of a HTTP
Does anyone know of a reliable way to validate International Bank Account Number (IBAN)
Does anyone know of a reliable way to cancel the ItemCheck event on a
Does anyone know a reliable way to distinguish between FALSE and NULL with PHPUnit?
Does anyone know if there is a way to generate different code in the
Does anyone know of a free tool, similar to what is built into Visual

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.