What is Deep Zoom for WPF?

One of the most "magical" features of Silverlight is Deep Zoom. Through the use of clever partitioning of images, Deep Zoom allows users to pan and zoom smoothly through immense (and potentially infinite) images with excellent performance. Since the release of Deep Zoom with Silverlight 2, it has been one of the most requested missing features from WPF.

DeepZoom.PNG

Well, your requests have been answered! This project is an implementation of Deep Zoom for WPF, complete with Deep Zoom Composer and Zoom.it support, multi-touch support and more.

Usage

To use the control, all you have to do is add a reference to DeepZoom.dll and add it to your XAML file as if it were a normal image:

<Window x:Class="DeepZoom.TestApplication.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dz="clr-namespace:DeepZoom.Controls;assembly=DeepZoom"
Title="MainWindow" Height="800" Width="1280">
<Border Background="Black">
<dz:MultiScaleImage Source="http://static.seadragon.com/content/misc/color-flower.dzi" />
</Border>
</Window>

Limitations and known issues

The current implementation of the control is a simplified version of the Silverlight MultiScaleImage, supporting only its most essential features. Its limitations ans known issues are:

  • The control only supports Deep Zoom images (including sparse images), with no support for Deep Zoom Collections yet.
  • Unsupported members from Silverlight:
    • Properties:
      • AllowDownloading
      • BlurFactor
      • IsDownloading
      • IsIdle
      • SkipLevels
      • SubImages
      • UseSprings
      • ViewportOrigin
      • ViewportWidth
    • Events:
      • ImageFailed
      • ImageOpenFailed
      • ImageOpenSucceeded
      • MotionFinished
      • ViewportChanged
  • The control only supports panning and zooming with mouse dragging/wheel and multi-touch, with no additional buttons for navigation (though they can be easily added).
  • The maximum number of tiles (total) is int.MaxValue (~2.1 billion). This is due to the use of IList/ItemsContainerGenerator for virtualization. Therefore, the maximum zoom level will be ~24 (depending on your image's aspect ratio).
  • The pan and zoom performance gets worse after level ~21. If you have an idea on how to fix this please let me know!

Tell me more!

For more information on the Deep Zoom control and how it's built, see the CodeProject article that explains its workings in details at http://www.codeproject.com/KB/WPF/DeepZoom.aspx .

Acknowledgements

This project uses code from the following libraries:

Special thanks to IntuiLab, my employer when this project was born, for allowing me to publish this project and article as open source!

Credits

Roberto Sonnino - 2010
http://virtualdreams.com.br/blog
Twitter: @robertos_br

Last edited Nov 24, 2010 at 12:33 PM by robertosonnino, version 5