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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:07:44+00:00 2026-05-11T19:07:44+00:00

How do I get the width available for the children of a scroll viewer

  • 0

How do I get the width available for the children of a scroll viewer in XAML? Thanks.

  • 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-11T19:07:45+00:00Added an answer on May 11, 2026 at 7:07 pm

    There’s no direct way of doing this that I know of, since WPF automatically passes the available space in to the child controls’ Measure() function so that they size to fit the available space.

    Note that, by default, it passes in infinity for the vertical direction, since content can scroll forever vertically. You can change the visibility of the scroll bars in both the vertical and horizontal direction to affect whether infinity is passed vertically, horizontally, or both.

    The best way of figuring out how wide the child controls actually have to layout in pure XAML would be to create an empty control – for instance, an empty grid – and then bind to its ActualWidth property:

    <ScrollViewer>
        <StackPanel>
            <Grid x:Name="MeasureGrid"/>
            <TextBox Text="{Binding ElementName=MeasureGrid, Path=ActualWidth}"/>
        </StackPanel>
    </ScrollViewer>
    

    Aside from displaying the width that is actually available to controls, I don’t see any other use for this information in XAML, though – all of the other scenarios I can think of can use this information implicitly. Can you give us more information on what you are trying to accomplish?

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

Sidebar

Related Questions

I want with ant access a subversion-repository and get a list of files available
How to get real image width & height (cross browser) by JavaScript function ?
How do I get the full width result for the *nix command ps ?
I have Perl code which relies on Term::ReadKey to get the terminal width. My
As in the subject, how can one get the total width of an element,
I'm trying to get a JEditorPane to highlight the full width of a displayed
I get obsessed with the best names for arrays and variables that I use,
I'm trying to get started with USSD . I'm familiar with other forms of
I'm trying to get started with unit testing in Python and I was wondering
What is the best way to get started with programming things outside of your

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.