Deep Zoom... so close!

I've been trying to put together a couple of articles on rolling your own Deep Zoom viewer, fed by a database with images all cut up for you. The image cutting I've got, the data I've got... but the MultiScaleImage control is not working as expected.

There are a couple of articles out there already that describe how to feed custom data to the control about image locations. Here's my version:

    public class ViewerSource : MultiScaleTileSource {
        public ViewerSource(int imageWidth, int imageHeight, int tileSize, int overlap, int imageID) : base(imageWidth, imageHeight, tileSize, tileSize, overlap)
        {
            ImageID = imageID;
        }

        public int ImageID { get; private set; }

        protected override void GetTileLayers(int tileLevel, int tilePositionX, int tilePositionY, System.Collections.Generic.IList<object> tileImageLayerSources)
        {
            string source = String.Format("http://localhost:2974/TileHandler.ashx?id={0}&level={1}&x={2}&y={3}", ImageID, tileLevel, tilePositionX, tilePositionY);
            Uri uri = new Uri(source, UriKind.Absolute);
            tileImageLayerSources.Add(uri);
        }
    }

If I step through the code, I can see that it's getting the URL's for the images right (I can cut and paste and see they work), but the requests are never made for them. In the constructor for the XAML page, I use this:

ViewerSource source = new ViewerSource(4372, 2906, 256, 0, 6);
msi.Source = source;

... where msi is the MultiScaleImage. For some reason, no go. Interestingly enough, when I put a break point on the .Add(uri), the IList<object> is empty, which doesn't seem right.

This is frustrating the heck out of me, because I feel like I'm pretty close. Does anyone else have experience with this? If I can't make it work, it might be an interesting exercise to try and do it in Javascript since I have the tile part all figured out.

4 Comments

Comments have been disabled for this content.