Skip to main content
Home Forums Silverlight Programming Programming with .NET - General How do you access scalemode in silverlight 3
5 replies. Latest Post by Min-Hong Tang - MSFT on November 9, 2009.
(0)
Jagunr
Member
2 points
6 Posts
11-04-2009 5:07 PM |
ScaleMode was available in silverlight 2 . I can't find it in silverlight 3.
bryant
Star
9937 points
1,629 Posts
11-04-2009 6:04 PM |
From the ASP.Net documentation for Silverlight:
In the Silverlight 2 SDK, you use markup like the following in the Silverlight control to implement stretch mode:<asp:Silverlight runat="server" Source="/clientbin/sample.xap" ScaleMode="Stretch" />In Silverlight 3, zoom functionality requires JavaScript that handles the Silverlight OnResize event. In the event handler, you apply a ScaleTransform object to the root of the XAML document. The following example shows the object tag that binds a function to the OnResize event.<object type="application/x-silverlight"> <param name="Source" value="/clientbin/sample.xap" /> <param name="OnResize" value="HandleResize" /> <!-- The default plugin-not-installed template goes here --> </object> The following example shows the stub of a JavaScript function that can handle the event. <script type="text/javascript"> function HandleResize(obj) { // Use ActualWidth and ActualHeight to calculate the transform. } </script>
<asp:Silverlight runat="server" Source="/clientbin/sample.xap" ScaleMode="Stretch" />
<object type="application/x-silverlight"> <param name="Source" value="/clientbin/sample.xap" /> <param name="OnResize" value="HandleResize" /> <!-- The default plugin-not-installed template goes here --> </object>
<script type="text/javascript"> function HandleResize(obj) { // Use ActualWidth and ActualHeight to calculate the transform. } </script>
The paste code feature on this site is messing with the example given, so if you can't read it just go to page 11 on the document that I linked to.
11-04-2009 6:54 PM |
do you have a link to a better more thorough example?
11-04-2009 8:12 PM |
You might try using this tip instead of coding up your own.
Silverlight 3 Hidden Feature: The <param name="EnableAutoZoom" value="True" /> parameter scales the app to browser zoom. http://is.gd/4mOEe
If that doesn't do what you're looking for let me know and I'll help you with the other approach.
11-05-2009 6:36 PM |
enable zoom does not work like the old scalemode.
Min-Hong...
Contributor
3584 points
411 Posts
11-09-2009 4:02 AM |
Hi,
You can also implement the scalemode effect youself. This is a link you can check:
http://forums.silverlight.net/forums/t/91678.aspx
Best Regards