0

I have a lot of images placed on a canvas (~150 pages converted PDF). I would like to be able to move around from one region to another of this canvas by animating the movement (zoom and pan).

My animation keys are in a listbox. I have a "play" button to play all. When I click an animation key, my "camera" automatically moves to the defined location.

It's a kind of "Prezi wall".

Sheridan
  • 68,826
  • 24
  • 143
  • 183

1 Answers1

0

This is only half or three quarters of an answer really, but hopefully you can fill in the gaps. You could try using the VisualBrush Class. First you set up the visual that the VisualBrush will paint using your full Canvas:

VisualBrush visualBrush = new VisualBrush();
visualBrush.Visual = yourCanvasElement;

You then paint with the Brush onto, let's say, a Rectangle element:

Rectangle rectangle = new Rectangle();
...
rectangle.Fill = visualBrush;

You can then use the VisualBrush.Viewbox property to move the content about. Now I think that there is some way of zooming in and out, but I can't remember at the moment.

Alternatively, you could use the ViewBox class. You can get your zooming effect by changing the size of the content and the ViewBox and get your panning effect by using a ScrollViewer. There's a post on StackOverflow that demonstrates this, so please take a look at the Zooming To Mouse Point With ScrollView and ViewBox in Wpf post for more help with this method.

Community
  • 1
  • 1
Sheridan
  • 68,826
  • 24
  • 143
  • 183