WPF - collapsing grid cells

Posted by user553765 on Stack Overflow See other posts from Stack Overflow or by user553765
Published on 2011-01-15T11:05:39Z Indexed on 2011/01/15 13:53 UTC
Read the original article Hit count: 155

Filed under:
|
|
|
|

Hi,

I'm having some problems with the layout of buttons on a screen. There are a number of buttons with the visibility set to collapsed depending on certain criteria.

Anyway, with the buttons sitting in a stackpanel, the contents determine the width of the buttons. Because these should share the same size, I put them in a grid where the columns are using the SharedSizeGroup.

Having done this, buttons now all share the same width, the smallest width needed to display the button with the largest content. What it does mean though is that buttons don't display at the required position.

That is - assume five buttons in columns 0-4 where the first button is collapsed, buttons should ideally all shift to the left so that they always occupy space left to right. Is there any way I can accomplish this or, if not, how can I get buttons in a stackpanel to share the same width?

Any help is much appreciated.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about button