Thanks to a good mathematician that goes by the moniker of rambler.elf, I was able to fix the zooming problem with my Media Magnifying glass Silverlight sample. After adding his fix, the zooming worked perfectly. I made two additional enhancements to simplify reuse – you can now use this with any MediaElement for video:
- Because of a limitation in Silverlight 1.0, the namescope mechanism that is used to avoid name conflicts with imported XAML, it makes it impossible to have a VideoBrush in a different namescope than its source MediaElement. I fixed this problem by adding a prefix to all of the names programatically once the XAML is downloaded. I did this with a regular expression (where Synergist.Magnifier.Prefix is "Synergist_Magnifier_"):
xaml = xaml.replace(/x:Name=\"/g, ‘x:Name="’ + Synergist.Magnifier.Prefix);
Then, when using FindName within the magnifier code, I use that prefix again.
- I added some instructions to the hosting page to aid in reuse.
If you want to watch a recording of the webcast where I explain the demo (and all of my earlier webcasts as well) go here: