I've heard a number of people wondering how to get mouse wheel working with DeepZoom images, unfortunately this doesn't work out of the box.
I've updated my mouse wheel sample from a little while back for Silverlight 2, the new version is really slick- Silverlight's DOM bridge is pretty powerful and I was able to do all of the browser hooks from managed code- no need for browser Javascript!
The updated project source can be found here and run from here.
Just the mouse wheel source is here.
The code to use to make a DeepZoom image zoom around the mouse:
I've updated my mouse wheel sample from a little while back for Silverlight 2, the new version is really slick- Silverlight's DOM bridge is pretty powerful and I was able to do all of the browser hooks from managed code- no need for browser Javascript!
The updated project source can be found here and run from here.
Just the mouse wheel source is here.
The code to use to make a DeepZoom image zoom around the mouse:
Point lastMousePos = new Point();
double zoom = 1;
public Page() {
InitializeComponent();
this.MouseMove += delegate(object sender, MouseEventArgs e) {
this.lastMousePos = e.GetPosition(this.ZoomImage);
};
new MouseWheelHelper(this).Moved += delegate(object sender, MouseWheelEventArgs e) {
double zoom = this.zoom;
if (e.Delta > 0)
zoom *= 1.3;
else
zoom /= 1.3;
Point logicalPoint = this.ZoomImage.ElementToLogicalPoint(this.lastMousePos);
this.ZoomImage.ZoomAboutLogicalPoint(zoom, logicalPoint.X, logicalPoint.Y);
};
}