WynApse Home Page
Home    Blog    About    Contact       
Latest Article:

My Tags:
My Sponsors:

Lifetime Member:

<SilverlightTooltip Number="004" Text="Visibility-Opacity" />

Let's talk for a few minutes about Visibility and Opacity. I mentioned in Tooltip 003 that you could use Visibility="Collapsed" to make your tooltip go away, and as I was reading over that, I thought it probably wouldn't hurt to discuss these two concepts a bit.


You can think about Visibility in terms of an object being 'visible' or not, but the fact that the opposite of "Visible" is "Collapsed" brings up a fundamental issue that bears noting. Every time I've spoken about this, It's been pointed out to me that "Collapsed" really is 'collapsed', it's not just 'not visible'. Because the object is collapsed, if other objects are placed relative to the location and size of the collapsed object, then the secondary placement is going to change when that happens. In other words, setting Visibility="Collapsed" can have an unwanted side effect on your layout.

Personally, I've yet to lay anything out in that manner, but it's still a good fact to keep in mind.

A "Collapsed" object takes no mouse hits, as would be expected. This is even more obvious when you consider it is actually 'collapsed'.


Opacity can be used for many things ... see-through panels, cool glass or glow effects, etc. If you set the Opacity on an object to "0", it is invisible. The thing to note about this situation, however, is that it is still in place, it just can't be seen. So an object of Opacity "0" can still take mouse hits.

This can be used to your advantage as well.. if you have an object of Opacity "0" above a control, for instance, the control will no longer take mouse messages even though it appears to be fully functional. If the object is also set to Visibility "Collapsed", the button can now receive messages.

Copyright © 2006-2017, WynApse