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?

有帮助吗?

解决方案

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;
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top