问题
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
...)
回答1:
Well well, 5 minutes after I posted this I found the VariableSizedWrapGrid! Its the exact replacement, just a different name (?!?).
回答2:
Another alternative:
- Install the Microsoft.Toolkit.Uwp.UI.Controls library package from NuGet
- Use the WrapPanel Control
Easy.
来源:https://stackoverflow.com/questions/33309439/uwp-wrappanel-replacement