Deniz Dogan
Deniz Dogan

Reputation: 26217

Panel which stacks child elements horizontally, fitting them into the available size

I'm looking for some layout panel for WPF which "stacks" its children horizontally, but fits them all into the panel, i.e. not like StackPanel which just keeps on adding them with their full width.

So for example, this magical panel is 1000 points wide. I add a child element to it, which gets the full 1000 point width. I add another one and the two children get 500 points each. I add yet another one and the three children now get 333.33333... point width. Et cetera.

Upvotes: 0

Views: 375

Answers (2)

Yuriy Zanichkovskyy
Yuriy Zanichkovskyy

Reputation: 1699

you can use UniformGrid, settings it's property - Rows to 1. This panel arranges childs in cell's of equal sizes.

Upvotes: 0

Bryan Anderson
Bryan Anderson

Reputation: 16129

<UniformGrid Rows="1" />

Should do the trick.

Upvotes: 2

Related Questions