开发者

What is the WPF equivalent for the FlowLayoutPanel?

开发者 https://www.devze.com 2022-12-26 17:21 出处:网络
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

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 wi开发者_Python百科ndows 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.

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.


Maybe Wrap panel will help.

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


The WrapPanel has similar behaviour to the old WinForms FlowLayoutPanel.

0

精彩评论

暂无评论...
验证码 换一张
取 消