Spacing buttons equally across a window in WPF

Saurabh Lalwani picture Saurabh Lalwani · Dec 15, 2009 · Viewed 12.4k times · Source

What's the best control to arrange buttons horizontally across a window in WPF? I am having trouble arranging the buttons evenly while resizing the window. I tried to use the stack panel but the buttons just stay at their position and do not space out to fill up the window space. Tried to use the dock panel as well but no luck yet.

Can anybody suggest me a good way to do it or tell me if I am doing anything wrong?

Answer

Kent Boogaart picture Kent Boogaart · Dec 15, 2009

How about a Grid or, even easier, UniformGrid?