How to align controls to size in WrapPanel in WPF

I have a wrapper panel that is dynamically populated with Label and TextBox controls. The display will look something like this:

Label 1 [text box] Label 4 [text box] Label 2 [text box] Label 5 [text box] Label 3 [text box]

etc.

How do I customize the cover panel to display the controls as above?

Also the window length is fixed, and sometimes there are many marks and they are cut off on the right side.

0


source to share


1 answer


It seems that I need to play around with the ItemWidth property of the Wrap Panel element.



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

      

+1


source







All Articles