0

I am new to WPF and xaml and I have a problem with my apps UI.
I am using this xaml code:

<ScrollViewer HorizontalAlignment="Left" Margin="252,12,0,0" Name="captchaControlsScrollableContainer" VerticalAlignment="Top">
    <Grid Name="captchaControls" Width="339" Height="286">
    </Grid>
</ScrollViewer>

And this code behind code that populates the grid:

captchaControls.Children.Add(new Captcha(data));

which is called more than one time
My problem is that only the first user control app apperas in the grid although in the debugger captchaControls.Children.Count is the right size and the scrollviewer's scrollbar is disabled.

Does anyone have any idea what I am doing wrong? Thank you in advance.

1

1 Answer 1

2

Your Grid in the scrollviewer is set to have 1 column and 1 row.So you will see only the last one you add so far (all others controls are "below" the last).

Take a look to the StackPanel control and maybe this tutorial will be useful.

Sign up to request clarification or add additional context in comments.

2 Comments

Made it work now except the scroll is always disabled. Any idea why?
You can try setting HorizontalScrollBarVisibility and VerticalScrollBarVisibility properties of scrollviewer to "Auto", or post some code for further help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.