Silverlight 3 now contains built in browser zoom support. The current problem I am facing is that it seems as if the Silverlight UI doesn't update (re-render) during multiple zoom level changes involving the (Ctrl+Mouse Wheel) or (Ctrl+) and (Ctrl-). This was found when testing with the IE8 browser, on a Windows XP SP2.
At first I thought this might be a performance problem when rendering my applcation but I also managed to reproduce the same problem with only some text and a button on my page (the test xaml can be found at the end of the post). In some cases the UI stops responding (mouse over visual changes). In others the Page is responding but is not rendered for the correct zoom level.
I could implement my own zoom functionality but I think it would be better in the long run to let the browser or plugin handle the zoom features (Why code the same feature twice?). I am also considering disabling the autozoom support for the silverlight application.
After looking at a few other silverlight implementations I found that the majority of them that do not disable the autozoom have the same problem. After looking into the problem a little deeper the UI would be corrected when the browser window size has changed (as this forces the UI to update its render size which corrects the problem) or if the Page is scrolled (which also seems to send a render update to the UI). Does anyone know of a way to solve this issue or a workaround that does not involve writing custom Zooming code?
Here are the steps I used to produce the problem. (If you would like the test project I used let me know and I can email it to you.)
Step 1: Create a new Silverlight application using Visual Studio 2008. Step 2: Add the Xaml to the main page (xaml at the end of my post). Step 3: Run the application in IE8 using the html page and the default start page. Step 4: Change the zoom level by using (Ctrl+mouse wheel). You may have to move the mouse wheel very rapidly till this occurs the first time. Usually zooming in then quickly zooming out. Note: After step 4 the UI will have some of the problems I stated above. This has been produced on 6 different machines running IE8.
Xaml code for the MainPage file:
<Grid x:Name="LayoutRoot">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Background="LightGray" Grid.Row="0">
<TextBlock Text="Testing Web Page" FontSize="16" FontWeight="Bold"
Foreground="Green"/>
</StackPanel>
<Button Grid.Row="1" Content="Large Damn Button" Height="34"/>
</Grid>