Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the WPF equivalent for the 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.

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.

like image 627
Sargola Avatar asked Apr 08 '10 11:04

Sargola


People also ask

What is control in WPF?

WPF SDK continues to use the term "control" to loosely mean any class that represents a visible object in an application, it is important to note that a class does not need to inherit from the Control class to have a visible presence.


2 Answers

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> 
like image 101
n535 Avatar answered Oct 04 '22 18:10

n535


The WrapPanel has similar behaviour to the old WinForms FlowLayoutPanel.

like image 25
Simon P Stevens Avatar answered Oct 04 '22 18:10

Simon P Stevens