#443 – Reversing the Flow Direction in a WrapPanel

You can set a WrapPanel to flow its children from right to left, rather then from left to right by setting the FlowDirection property to RightToLeft.  (The default is LeftToRight).

For a horizontally oriented WrapPanel, elements will fill in the top row from right to left, flowing to the second row when the first one fills up.  For a vertically oriented WrapPanel, elements will fill in the rightmost column from top to bottom and then move to the next column to the left when the first column fills up.

Below are examples of each combination of Orientation and FlowDirection.

Orientation = Horizontal, FlowDirection = LeftToRight (the default).

Orientation = HorizontalFlowDirection = RightToLeft.

Orientation = VerticalFlowDirection = LeftToRight (the default).

Orientation = VerticalFlowDirection = RightToLeft.

You would normally use right-to-left flow in culture that present text from right to left (e.g. Arabic).  But you can also use it whenever this layout makes sense for your application.

Advertisement

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

One Response to #443 – Reversing the Flow Direction in a WrapPanel

  1. Jonathan says:

    Thanks for this article as it came in handy.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: