开发者

WPF: filling the "gap" in a StackPanel of buttons when removing one of the buttons

I am defining a StackPanel containing multip开发者_StackOverflowle Buttons in my xaml file. I'd like to be able to remove buttons based on some events, and have the "gap" where that button was be filled by having the following Buttons move up on the screen.

I used:

buttonName.Visibility = System.Windows.Visibility.Hidden;

but that just hides the button and leaves a gap.

Would it be simpler to add the buttons to the StackPanel in the .cs file, and if one button is removed than I just add one less button to my window? And if so, how do I add a button from the .cs file?


Have you tried using Visibility.Collapsed

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜