My first blog post will be a small but useful little tip. One of the things that's not built into deep zoom is the ability to specify at which level to stop zooming out, and at which level to stop zooming in.
Check out the following example (which I will use in future blog posts for more examples). Please note that there is a bug in the mousehandler here where the browser still captures the wheel (not just the app), something I intend to fix in a future post.
Launch in a separate window
This example is a very deep sparse image - it is a collection of vacation pictures I took while I was in Europe last summer. I laid them out nicely for a pleasant browsing experience.
One of the issues with simply checking the zoom level and resetting it when the zoom level passes a certain point is that Deep Zoom uses its own animations for zooming to a certain level. So simply checking the current zoom level when a user flicks the mouse wheel and ensuring that a certain level of zoom isn't passed doesn't do the trick - at the time you set the new zoom level, Deep Zoom only initiates the animation, but the current zoom level will not have changed. You need to instead anticipate what the zoom level will be after you zoom, and make sure to adjust the target zoom rate appropriately.
The way this is done here is to keep track of my own zoom level, check how deep I've zoomed in or how far I've zoomed out at any given time.
Another thing that's been done here is to open the XML file for the image, and check for the extents of the image and not let the user zoom any further than 2x the maximum resolution of the image. This was done using the LINQ library in Silverlight. Note that you also have to take into account the namespace in the Deep Zoom image XML file, which is something for which I haven't seen any examples on the web, but it's part of the project below:
Zooming with Constraints Sample
Note: I didn't include the image in the sample because it's too big (167 megs). When you build and run the app, you won't see the content, though the concepts are all there.