Sam
Sam

Reputation: 943

Visibility change of Shapes in a WPF Canvas

Is there any event that can be raised when a shape in a Canvas(which has zoom and pan controls using Translatetransform/ScaleTransform) becomes visible/invisible when the canvas is panned or zoomed?

Any leads on ways to do this will be helpful and is appreciated. Thanks!

Upvotes: 2

Views: 442

Answers (1)

Patrick Klug
Patrick Klug

Reputation: 14391

I assume you mean a canvas inside a scrollviewer? No, there is no such event as the canvas is unaware of the visible part. As far as the canvas is concerned everything is always visible.

You should be able to do this yourself by listening to scale,pan changes and then checking the visible viewport of the scrollviewer against your objects in your canvas.

Upvotes: 1

Related Questions