-1

I have a wpf (mvvm-light) based form, with Grid and a six buttons, three in a row in two columns. As buttons can be turned on/off in settings, I want to hide some of them, but I don't want to have empty spaces. How can I achieve this ?

Milan M.
  • 959
  • 3
  • 12
  • 27

1 Answers1

3

Use a WrapPanel and set the visibility for a hidden button to Visibility.Collapsed (not Visibility.Hidden which hides the control but the space for it is still reserved). You could bind the visibility to a settings value for example.

See here: Difference between Visibility.Collapsed and Visibility.Hidden

Community
  • 1
  • 1
Tim Rutter
  • 4,549
  • 3
  • 23
  • 47