Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UWP WrapPanel Replacement?

Tags:

c#

xaml

uwp

Is there a replacement for this WPF code?

<WrapPanel>
    <TextBlock Width="100" Height="20"/>
    <TextBlock Width="30" Height="50"/>
    <TextBlock Width="150" Height="70"/>                    
</WrapPanel>

This is really stupid if there is none...

Update:

I forgot to mention that the width of the WrapPanel is smaller than the total width of all the TextBlocks combined. This means that some of the items need to wrap to a second row.

I thought that this is what most people used a WrapPanel for, but apparently some use it for a Horizontal StackPanel (In this case, you should set the StackPanel's Orientation to Horizontal...)

like image 290
James Esh Avatar asked Oct 23 '15 18:10

James Esh


2 Answers

Well well, 5 minutes after I posted this I found the VariableSizedWrapGrid! Its the exact replacement, just a different name (?!?).

like image 94
James Esh Avatar answered Oct 20 '22 17:10

James Esh


Another alternative:

  1. Install the Microsoft.Toolkit.Uwp.UI.Controls library package from NuGet
  2. Use the WrapPanel Control

Easy.

like image 26
usefulBee Avatar answered Oct 20 '22 16:10

usefulBee