1

i am adding button in Stack panel(and grid within scroll view) at run time. so some button is visible and some are invisible depends on the height of the stack panel(and grid). Here visibility means display area of Stack panel (and grid) However when user scroll, then next some buttons make visible. Actually i want to download a image from web when any button become visible. So i want to ask whether there are any event available for this type of requirement?

Please suggest.

H.B.
  • 166,899
  • 29
  • 327
  • 400
Rupesh
  • 7,866
  • 11
  • 41
  • 58

1 Answers1

2

http://blogs.msdn.com/b/llobo/archive/2007/01/18/elements-visibility-inside-scrollviewer.aspx

alternatively
You can use Data Visualization if you have the option to customize the StackPanel

If you need to determine whether element is visible or not over Mouse,
you can use Visual Tree Helper or Mouse.DirectlyOver.

wpf-ways-to-find-controls

VisualTreeHelper.HitTest

http://lukieb.blogspot.in/2008/07/visualtreehelperhittest.html

http://rongchaua.net/blog/c-wpf-hit-testing-example/

Community
  • 1
  • 1
Tilak
  • 30,108
  • 19
  • 83
  • 131
  • 1
    Yes, the VisualTreeHelper.HitTest is the way to go here. Here is detailed a solution for a similar problem: http://stackoverflow.com/questions/1517743/in-wpf-how-can-i-determine-whether-a-control-is-visible-to-the-user/42254899#42254899 – Ofer Barasofsky Feb 21 '17 at 15:53