FlowLayoutPanel的WPF等效项是什么? [英] What is the WPF equivalent for the FlowLayoutPanel?

查看:489
本文介绍了FlowLayoutPanel的WPF等效项是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发WPF应用程序(一个笔记克隆,称为记录您的生活"),您可以在其中动态地将标签分配给条目(就像现在几乎在任何Web 2.0应用程序中一样).为此,我在Windows窗体原型中拥有一个FlowLayoutPanel原型,可以很好地完成这项工作.如果空间不足,我想让标签浮动到下一行,并在需要时获取滚动条.

I am working on a WPF application (a one note clone which is called "note your life") where you can dynamically assign Tags to an entry (just as in virtually any web 2.0 app these days). for this I had in my windows forms prototype a FlowLayoutPanel that did the job very well. I want to have the tags float to the next line if there isn't enough space and get a scrollbar if needed.

如何使用WPF做到这一点?我玩过

How can this be achieved with WPF? I played around with

<StackPanel Orientation="Horizontal" FlowDirection="LeftToRight" ...>

但是如果需要的话,这不会移动下一行中的元素.

but this doesn't move the elements in the next line if needed.

推荐答案

也许包装面板会有所帮助.

<WrapPanel Orientation="Horizontal">
    <Button Margin="3">Button 1</Button>
    <Button Margin="3">Button 2</Button>
    <Button Margin="3">Button 3</Button>
    <Button Margin="3">Button 4</Button>
    <Button Margin="3">Button 5</Button>
</WrapPanel>

这篇关于FlowLayoutPanel的WPF等效项是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆