Positioning and Centering a Deep Zoom

I have seen a few people struggling with how to center their single image Deep Zooms on a specific point on their screen. Here's how I do it.
void msi_Reset()
{
    msi.UseSprings = false;
    msi.ViewportOrigin = new Point(0, 0);

    msi.MotionFinished += new RoutedEventHandler(msi_Center);

    double MSISize = 3;
    if (msi.AspectRatio > 1)
    {
        msi.ViewportWidth = MSISize;
    }
    else
    {
        msi.ViewportWidth = MSISize / msi.AspectRatio;
    }

}

void msi_Center(object sender, RoutedEventArgs e)
{
    msi.MotionFinished -= msi_Center;

    Point center = msi.ElementToLogicalPoint(new Point(-msi.ActualWidth / 2, -msi.ActualHeight / 2));
    center.X += 0.5;
    center.Y += 0.5 / msi.AspectRatio;

    msi.ViewportOrigin = center;

    msi.UseSprings = true;
}

Silverlight install

I finally managed to get the Silverlight 3 beta installed and working on my work computer yesterday after facing a few issues. The first issue I faced was needing to do an offline install since the Silverlight Tools installer was blocked from downloading the required files. This was easy enough and the process can be found on Tim Heuer's blog. After that I thought I would be away laughing but when I loaded up Visual Studio I had no syntax highlighting on XAML files and all these errors saying "Package 'Microsoft.VisualStudio.Xaml' has failed to load... blah blah... You may use 'devenv /resetskippkgs' to re-enable package loading." Running the 'devenv /resetskippkgs' didn't seem to do a lot and it was about here that things all started to go horribly wrong. I uninstalled Visual Studio, tried the express editions, reinstalled Visual Studio, uninstalled Silverlight 3 beta, tried installing Silverlight 2... but it failed. Somewhere along the way Silverlight 3 wasn't uninstalling completely and I managed to find Bob Pomeroy's Blog on how to manually clean a bad Silverlight install. So after deleting a few registry keys, a program files folder and a half finished install I was all set to try again. This time everything installed sweet as and everything’s working as it should.

Expression For Art's Sake

Holy hell the last week has been busy. Last week while I was up at Web09 I was talking to Nigel Parker from Microsoft and he invited me along to the Expresion For Art's Sake workshop that he was holding here in Wellington this week. It just finished today and since it started I have spent pretty much spent every waking hour knee deep in Silverlight development. Before this week I had hardly touched Silverlight and now I don't think I can live without it. Even though Silverlight is very different from Flash, I think having that Flash background let me pick it up fairly quickly. I have spent most of this week working on a Deep Zoom project which I will keep chipping away at over this weekend and hopefully have something to show next week. Its unreal to think how much I have learnt from this event. On Monday I wouldn't have known where to start yet now I feel like I could knock anything out as a Silverlight app. I have to redevelop our wayfinders at work by the end June and I think that this will be an ideal project to truly put Silverlight through its paces. Ah well big thanks to Nigel , Tim and Arturo -  for the awesome week thats been.