1

I'm adding controls dynamically to the StackPanel but all of them are aligned vertically and the items overpass the limit of the Height and not all items are displaying.

Is possible to align the controls based on the height and put it in several columns depending the number and height of the items?

<ScrollViewer  Grid.Column="2" x:Name="DetailInfoScroll"  Margin="25,0,50,0" Style="{StaticResource HorizontalScrollViewerStyle}" >
<StackPanel Grid.Column="2" Margin="25,0,50,35" HorizontalAlignment="Left"  VerticalAlignment="Center" x:Name="StkText">
</StackPanel>
</ScrollViewer>

Adding the controls:

  foreach (var text in texts)
    {
            StkText.Children.Add(new TextBlock
            {
                Text = text,
                TextWrapping = TextWrapping.Wrap,
                TextAlignment = TextAlignment.Justify,
                FontSize = 14,
                Margin = new Thickness(0, 0, 0, 25)
            });

    }
1
  • GridView works like this and it is used in several of the sample projects that you can create from VisualStudio. Commented Nov 4, 2013 at 21:27

2 Answers 2

1

I found a solution using VariableSizedWrapGrid

http://msdn.microsoft.com/library/windows/apps/br227651.aspx

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

Comments

0

I think what you asking for is called WrapPanel. I hope I am not wrong. :)

Check those links out:

http://msdn.microsoft.com/en-us/library/system.windows.controls.wrappanel.aspx

http://msdn.microsoft.com/en-us/library/ms754152.aspx

Comments

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.