Skip to main content

Microsoft Silverlight

Answered Question How do you access scalemode in silverlight 3RSS Feed

(0)

Jagunr
Jagunr

Member

Member

2 points

6 Posts

How do you access scalemode in silverlight 3

ScaleMode was available in silverlight 2 . I can't find it in silverlight 3.

bryant
bryant

Star

Star

9937 points

1,629 Posts

Silverlight MVP

Re: How do you access scalemode in silverlight 3

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>
 

 

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.

-- bryant

Blog | Twitter
_________________
Dont forget to click "Mark as Answer" on the post that helped you.

Jagunr
Jagunr

Member

Member

2 points

6 Posts

Re: Re: How do you access scalemode in silverlight 3

do you have a link to a better more thorough example?

bryant
bryant

Star

Star

9937 points

1,629 Posts

Silverlight MVP
Answered Question

Re: Re: Re: How do you access scalemode in silverlight 3

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.

-- bryant

Blog | Twitter
_________________
Dont forget to click "Mark as Answer" on the post that helped you.

Jagunr
Jagunr

Member

Member

2 points

6 Posts

Re: Re: Re: Re: How do you access scalemode in silverlight 3

enable zoom does not work like the old scalemode.

Min-Hong Tang - MSFT
Min-Hong...

Contributor

Contributor

3584 points

411 Posts

Answered Question

Re: Re: Re: Re: How do you access scalemode in silverlight 3

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

Min-Hong Tang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities