如何显示可变大小的项目?
How to display variable sized items?
我有一个字符串列表,我希望它们可以单击并水平并排显示,如果没有 space 剩余,容器应继续在下一行中排列项目。请帮我。
您应该使用 WrapPanel 来获得这种布局。它在 Windows 运行时标准控件中不可用,here 您可以找到它的实现。
用法:
<ItemsControl>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<controls:WrapPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemControl.Items>
<!-- put your strings here or use ItemTemplate instead -->
</ItemControl.Items>
</ItemsControl>
我有一个字符串列表,我希望它们可以单击并水平并排显示,如果没有 space 剩余,容器应继续在下一行中排列项目。请帮我。
您应该使用 WrapPanel 来获得这种布局。它在 Windows 运行时标准控件中不可用,here 您可以找到它的实现。
用法:
<ItemsControl>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<controls:WrapPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemControl.Items>
<!-- put your strings here or use ItemTemplate instead -->
</ItemControl.Items>
</ItemsControl>