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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:44:48+00:00 2026-05-23T15:44:48+00:00

How can I access the ScrollViewer which is created automatically by this ListBox? I

  • 0

How can I access the ScrollViewer which is created automatically by this ListBox? I need to ScrollToBottom;

 <ListBox Name="messageListBox" Height="300"  >
        <ListBox.ItemTemplate >
            <DataTemplate>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding Path=LastUpdateDT, StringFormat=HH:mm}" Margin="0,0,5,0"/>
                    <TextBlock Text="{Binding Path=Message}"/>
                </StackPanel>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>
  • 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-23T15:44:48+00:00Added an answer on May 23, 2026 at 3:44 pm

    You can recurse down the visual tree and grab the element:

    var scroller = GetLogicalChildrenBreadthFirst(messageListBox)
                       .OfType<ScrollViewer>().First();
    
    /// <summary>
    /// Helper function that returns a list of the visual children.
    /// </summary>
    /// <param name="parent">Element whose visual children will be returned.</param>
    /// <returns>A collection of visualchildren.</returns>
    private IEnumerable<FrameworkElement> GetLogicalChildrenBreadthFirst(FrameworkElement parent)
    {
        if (parent == null) throw new ArgumentNullException("parent");
    
        Queue<FrameworkElement> queue = new Queue<FrameworkElement>(GetVisualChildren(parent).OfType<FrameworkElement>());
    
        while (queue.Count > 0)
        {
            FrameworkElement element = queue.Dequeue();
            yield return element;
    
            foreach (FrameworkElement visualChild in GetVisualChildren(element).OfType<FrameworkElement>())
                queue.Enqueue(visualChild);
        }
    }
    
    /// <summary>
    /// Helper function that returns the direct visual children of an element.
    /// </summary>
    /// <param name="parent">The element whose visual children will be returned.</param>
    /// <returns>A collection of visualchildren.</returns>
    private IEnumerable<DependencyObject> GetVisualChildren(DependencyObject parent)
    {
        if (parent == null) throw new ArgumentNullException("parent");
    
        int childCount = VisualTreeHelper.GetChildrenCount(parent);
        for (int counter = 0; counter < childCount; counter++)
        {
            yield return VisualTreeHelper.GetChild(parent, counter);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We can access session data in controllers and views like this: Session[SessionKey1] How do
I can access this CSS stylesheet from sub-category (folder) by: <link rel=stylesheet type=text/css href=../style.css
I can access a PHP var with Javascript like this: <?php $fruit = apple;
In PHP I can access class attributes like this: <?php // very simple :)
I can access this webpage in my firefox browser: http://www.ip-adress.com/ip_tracer/74.82.190.99 So I can get
I can access a value like driver.my_friends[793659690].name but now I am using it in
In Java you can access variables in a class by using the keyword this
Can i access an application which is running in the background from a browser
We can access the Super Class methods which consists of operations on private data
I can access the database either from a .NET program (using ODBC) or through

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.