UWP WrapPanel Replacement?

青春壹個敷衍的年華 提交于 2019-12-22 03:43:58

问题


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:

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

Easy.



来源:https://stackoverflow.com/questions/33309439/uwp-wrappanel-replacement

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!