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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:39:34+00:00 2026-05-31T16:39:34+00:00

I have a standard Panorama-based application, but one key item of data is repeated

  • 0

I have a standard Panorama-based application, but one key item of data is repeated in two adjacent PanoramaItems.

I would like those two PanoramaItems to have the same vertical scroll position (to save the user having to find the key item again).

Is there a way to get and set the scroll position of the PanoramaItem control and detect the scroll change?

Generic solution (thanks to Paul Diston for the clues):

    /// <summary>
    /// Scroll each new PanoramaItem to the same position as the previous one
    /// </summary>
    private void Panorama_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        if (e.RemovedItems.Count > 0 && e.AddedItems.Count > 0)
        {
            // Add logic here if only specific PanoramaItems are required to sync

            ScrollViewer firstChildAsScrollViewer =
                GetChildOfType(e.RemovedItems[0] as DependencyObject, typeof (ScrollViewer)) as ScrollViewer;
            ScrollViewer secondChildAsScrollViewer =
                GetChildOfType(e.AddedItems[0] as DependencyObject, typeof (ScrollViewer)) as ScrollViewer;
            if ((firstChildAsScrollViewer != null) && (secondChildAsScrollViewer != null))
            {
                secondChildAsScrollViewer.ScrollToVerticalOffset(firstChildAsScrollViewer.VerticalOffset);
            }
        }
    }

    /// <summary>
    /// Bredth-first recursive check for a child of the specified type
    /// </summary>
    private DependencyObject GetChildOfType(DependencyObject element, Type type)
    {
        int count = VisualTreeHelper.GetChildrenCount(element);
        for (int i = 0; i < count; i++)
        {
            var e = VisualTreeHelper.GetChild(element, i);
            if (e.GetType() == type)
            {
                return e;
            }
        }
        // Now try the grandchildren
        for (int i = 0; i < count; i++)
        {
            var e = VisualTreeHelper.GetChild(element, i);
            var ret = GetChildOfType(e, type);
            if (ret != null)
            {
                return ret;
            }
        }
        return null;
    }
  • 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-31T16:39:35+00:00Added an answer on May 31, 2026 at 4:39 pm

    You could use the VisualTreeHelper to access and set the VerticalOffset of the ScrollViewer of the ListBox controls :-

        private void Panorama_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DependencyObject firstChild = VisualTreeHelper.GetChild(this.FirstListBox, 0);
    
            ScrollViewer firstChildAsScrollViewer = firstChild as ScrollViewer;
    
            DependencyObject secondChild = VisualTreeHelper.GetChild(this.SecondListBox, 0);
    
            ScrollViewer secondChildAsScrollViewer = secondChild as ScrollViewer;
    
            if ((firstChildAsScrollViewer != null) && (secondChildAsScrollViewer != null))
            {
                secondChildAsScrollViewer.ScrollToVerticalOffset(firstChildAsScrollViewer.VerticalOffset);
            }
        }
    

    Hope this helps.

    Paul Diston

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

Sidebar

Related Questions

I have a Panorama Application, where one of the panorama items is 'Favorites'. I
I've heard they have standard GUI guideline, but I can't seem to find a
I have a standard Forge generated Trigger.io app, I made a separate one to
I have a standard code like below to validate xml against xsd, but it
I have a web application that have standard form authentication declared, like this: <login-config>
Ok, So I have standard sencha-touch panel, and because this application needs to be
I have a standard style for my buttons but I want certain parts of
I have a standard HTML login page, which I would much rather use than
I have standard multi-level menu like this one: <ul id=nav> <li><a href=#>Home</a></li> <li><a href=#>Dropdown</a>
I have standard class library infrastructure assembly which i reference in my main application.

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.