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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:26:00+00:00 2026-06-06T13:26:00+00:00

I was trying to implement a ScrollViewer like so; <Height=auto Width=auto MaxHeight=500 MaxWidth=400 ResizeMode=NoResize

  • 0

I was trying to implement a ScrollViewer like so;

<Height="auto" Width="auto"
            MaxHeight="500" MaxWidth="400"
            ResizeMode="NoResize" WindowStyle="None">
        <Grid>
            <StackPanel>
                <ScrollViewer Name="scrlBr">
                    <StackPanel Orientation="Vertical">
                        <TextBlock Name ="txtBlock" Margin="10" Height="auto" 
Width="auto" TextWrapping="Wrap"></TextBlock>
                        <Button Name="btnOk" Click="btnOk_Click" Width="80"
HorizontalAlignment="Center">Close!</Button>
                    </StackPanel>
                </ScrollViewer>
                <Label HorizontalAlignment="Center" FontSize="3" 
Name="lblScrollDown">\/</Label>
            </StackPanel>
        </Grid>
    </Window>

The problem I’m having is that the scroll bar appears disabled, while the text obviously goes down off the window and I can’t see the btnOk. Surely if the window has a fixed height and the TextBlock and Button, which are contained in the Scrollviewer, are bigger than the window then the ScrollBar should be enabled, no?

UPDATE

I worked out that the problem lies in having the ScrollViewer within a StackPanel. Might try it with a Grid instead… Update to come.

SOLUTION

I was right about the Stackpanel being the problem and went with Heinzi’s suggestion of using the DockPanel and all’s workin’ fine. 🙂 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-06-06T13:26:01+00:00Added an answer on June 6, 2026 at 1:26 pm

    The problem is your StackPanel. It always takes all the vertical space it needs, so the container of the ScrollPanel is much larger than the window itself, and the ScrollViewer sees no need to scroll.

    Solution: Replace the StackPanel with a DockPanel. Move the <Label> declaration to the top and dock it to the bottom of the DockPanel. The last child in a DockPanel (which is the ScrollViewer in this case) always fills the remaining space:

    <Grid> 
        <DockPanel> 
            <Label DockPanel.Dock="Bottom" ... Name="lblScrollDown">\/</Label> 
            <ScrollViewer Name="scrlBr"> 
                 ...
            </ScrollViewer> 
        </DockPanel> 
    </Grid> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to implement panning within a Canvas within a scrollviewer like: <ScrollViewer> <Canvas>
I'm trying to implement a Paginator like this: public class MyPaginator : DocumentPaginator{ //
I am trying to implement something like an action bar in android 2.2 .
Hey guys I'm trying to implement a scroll with page control, like the iPhone
I'm trying to implement a diagram with movable/resizeable parts in WPF. I would like
Trying to implement a rating system of users and postings. What is the best
Trying to implement a UITableView of names similar to the built-in Contacts iPhone app
While trying to implement an MVC file upload example on Scott Hanselman's blog. I
im trying to implement some behaviors when a mapview element scrolls... by coding a
when trying to implement an Aspect, that is responsible for catching and logging a

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.