【问题标题】:What is the WPF equivalent for the FlowLayoutPanel?FlowLayoutPanel 的 WPF 等效项是什么?
【发布时间】:2010-04-08 11:32:40
【问题描述】:

我正在开发一个 WPF 应用程序(一个名为“note your life”的笔记克隆),您可以在其中动态地将标签分配给一个条目(就像现在几乎所有的 web 2.0 应用程序一样)。为此,我在我的 windows 窗体原型中有一个 FlowLayoutPanel,它做得很好。如果没有足够的空间,我想让标签浮动到下一行,并在需要时获得一个滚动条。

如何使用 WPF 实现这一点?我玩过

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

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

【问题讨论】:

    标签: wpf layout wpf-controls flowlayoutpanel


    【解决方案1】:

    也许Wrap panel 会有所帮助。

    <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>
    

    【讨论】:

      【解决方案2】:

      WrapPanel 的行为与旧的 WinForms FlowLayoutPanel 类似。

      【讨论】:

      • 这是一个答案而不是一个问题?
      猜你喜欢
      • 2012-10-16
      • 1970-01-01
      • 1970-01-01
      • 2010-09-14
      • 1970-01-01
      • 2011-03-11
      • 1970-01-01
      • 2010-10-01
      • 1970-01-01
      相关资源
      最近更新 更多