0

Lets say you have a WrapPanel with a labels:

<WrapPanel>
    <Label Content="My Label" HorizontalContentAlignment="Center" />
    <Label Content="My Label 2" HorizontalContentAlignment="Center" />
</WrapPanel>

Basically, I want each of these to fill a full line in the wrappanel. This seems like a simple thing to do, however, I can't seem to find out how.

I know that you can do it using the 'Width' property, however, I don't want a hard coded width.

B-Rad
  • 1,519
  • 5
  • 17
  • 32

1 Answers1

2

If you want each label to be stacked, rather than wrapping, use a StackPanel instead of a WrapPanel:

<StackPanel>
    <Label Content="My Label" HorizontalContentAlignment="Center" />
    <Label Content="My Label 2" HorizontalContentAlignment="Center" />
</StackPanel>
Fenton
  • 241,084
  • 71
  • 387
  • 401
  • That would work for just those two labels, however, I have more Items that need to be wrapped. – B-Rad Mar 12 '13 at 15:52
  • You need to include those in your question if we are to stand a reasonably chance of answering. I would add the items you want to wrap to a separate `WrapPanel`. – Fenton Mar 12 '13 at 15:56
  • @B-Rad What does "wrapped" mean when each Label fills a line? That doesn't make sense. – Clemens Mar 12 '13 at 16:19
  • Yes. fills a line. I think I want a WrapPanel to wrap vertically and horizontally at the same time, which just isn't the way things work. – B-Rad Mar 12 '13 at 19:44