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 6935271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:04:49+00:00 2026-05-27T12:04:49+00:00

In WPF, I have a scrollviewer with 7 different groupboxes in it. Each groupbox

  • 0

In WPF, I have a scrollviewer with 7 different groupboxes in it. Each groupbox is it’s own individual section for different forms. Because the scrollviewer is so long, I’ve placed a series of buttons in a stackpanel on the left side of the panel, and done code-behind so that clicking a button triggers the BringIntoView method for the corresponding groupbox.

My question is, is there any way to force BringIntoView to position the groupbox at the top of the visible section each time. By default BringIntoView only moves the scrollviewer until the entire groupbox is within view, not so that it’s the topmost item displayed. Is there a way around this?

I looked into using ScrollToVerticalOffset, but couldn’t figure out how to get the right position, mostly because it’s saying that groupbox has no Locate property, which I was going to use to get the position, then set it with ScrollToVerticalOffset. One thing I thought of while typing this was to have each button-press jusmp to the top groupbox first, then immediately continue to the correct one, but this seems kind of hack-ish, and I prefer to find the correct way. 🙂

  • 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-05-27T12:04:50+00:00Added an answer on May 27, 2026 at 12:04 pm

    Try this one:

    private void ScrollToGroupBox(GroupBox groupBox)
    {
      GeneralTransform groupBoxTransform = groupBox.TransformToAncestor(scrollViewer);
      Rect rectangle = groupBoxTransform.TransformBounds(new Rect(new Point(0, 0), groupBox.RenderSize));
      scrollViewer.ScrollToVerticalOffset(rectangle.Top + scrollViewer.VerticalOffset);
    }
    

    The code gets the position of your GroupBox inside the Scrollviewer and scrolls to it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm moving my old app from windows forms to WPF and have encountered an
I have a WPF ListView within a ScrollViewer. I need to collapse the ListView
I have an application written in WPF with a ScrollViewer controlling a Canvas. This
I have a WPF TabControl with two TabItems. Each TabItem contains a ListBox with
I have a WPF 3.5 MVVVM application which has a TextBlock in a ScrollViewer.
I have a WPF scrollViewer that I use for panning (MouseDown, MouseMove, MouseUp) and
I have WPF DataGrid placed on the Window . I have a button which
I'm trying to skin a ScrollViewer in WPF using XAML but have been faced
I have a data entry form in WPF built using a Scrollviewer with various
do routed events from wpf have something in common with the chain of responsibility

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.