Obviously both prevent the element from being viewed.
Visibility.Hidden
reserves the space that the element will occupy in layout , so nothing will be redrawn except in that area. Everything is fixed in place, hiding or not. It just hides, but the element is there.
Visibility.Collapsed
does not reserve the space and layout , and may require redesigning other elements to adjust positions. It will set height and length to zero and the element will no longer be there.
If you only change the width
and height
the element will change the layout , equal to Collapsed
, but the element remains present, equal to Hidden
, even if invisible, keeping characteristics of something available, active. For example, it may gain focus when controls are changing elements in navigation, most likely with TAB . There may be other consequences. Unless you just want to get the element off the screen, taking its space, but remain there, it is wrong to use that technique.
Documentation .