Determining if object is visible and clickable
Posted
by
Alan Mendelevich
on Stack Overflow
See other posts from Stack Overflow
or by Alan Mendelevich
Published on 2011-03-13T07:34:29Z
Indexed on
2011/03/13
8:10 UTC
Read the original article
Hit count: 166
Silverlight
|windows-phone-7
I'm looking for ways to effectively determine if a control is actually visible and clickable. I mean beyond checking Visibility property of the object.
I can check RenderSize and that would be [0,0] if any of the parent elements is collapsed. So this is simple too. I can also traverse up the visual tree and see if Opacity of all elements is set to 1.
What I don't know how to check nicely are these scenarios:
- The object is obstructed by some other object. Obviously it's possible to use FindElementsInHostCoordinates() and do computations to find out how much these objects obstruct but this could be an overkill. I can also make a "screenshot" of the object in question and "screenshot" of the whole page and check if pixels where my object should be match the actual object pixels. That sounds like an overkill too.
- The object is obstructed by a transparent object that still "swallows" clicks (taps). The workarounds for the first problem could still fail in this scenario.
Any better ideas? Do I miss something?
Thanks!
© Stack Overflow or respective owner