I'm looking for ways to effectively determine if a control is really visible and viewable. I mean, without checking the Visibility property of the object.
I can check RenderSize and it will be [0,0] if any of the parent elements are collapsed. So it's easy too. I can also cross the visual tree and see if the opacity of all elements is set to 1.
What I don't know is how to test these scenarios well:
- An object is obstructed by another object . Obviously, you can use FindElementsInHostCoordinates () and perform calculations to find out how much these objects are obstructing, but this can be redundant. I can also take a “screenshot” of the object in question and “screenshots” of the entire page and check if the pixels match where my object should correspond to the actual pixels of the object. This also seems to be superfluous.
- The object is hindered by a transparent object, which is still "swallowing" clicks (taps) . Workarounds for the first issue may still crash in this scenario.
Refresh (another scenario)
- The object is outside the parent object / screen . Is there any other way to find out, besides a lot of calculations?
Any better ideas? Did I miss something?
Thanks!
windows-phone-7 silverlight
Alan mendelevich
source share