Question

I noticed that BorderStlye has an explicit None for "Do not show a Border" and a NotSet, which causes the control to revert to its default or CSS style.

I'd like to set the height of a panel to 0 in some cases, but then be able to return it to whatever height is designated in the style sheet, similar to what can be done with BorderStyle. Can this be done?

Was it helpful?

Solution

You can use Unit.Empty:

myPanel.Height = Unit.Empty;

This will reset the implicit value you set before.

But if you want to hide a Control, there are better ways than setting the height to 0.

myPanel.Visible = false;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top