azamsharp
azamsharp

Reputation: 20066

How to align variable size controls inside the WrapPanel in WPF

I have a wrap panel that is dynamically populated with Label and TextBox control. The display will be something like this:

Label 1 [textbox] Label 4 [textbox] Label 2 [textbox] Label 5 [textbox] Label 3 [textbox]

and so on...

How can I setup the wrap panel so that it displays the controls like above?

Also the window length is fixed and sometimes there are many labels and they are cut off from the right hand side.

Upvotes: 0

Views: 1745

Answers (1)

azamsharp
azamsharp

Reputation: 20066

It seems like I have to play around with the ItemWidth property of the Wrap Panel control.

<WrapPanel Width="Auto" ItemWidth="60" Height="Auto" HorizontalAlignment="Left" Orientation="Horizontal" x:Name="textBoxPanel" />

Upvotes: 1

Related Questions