Automatically adjusts the Silverlight Size Based on the browser size.
Add
Browserhost. Resize + = New Eventhandler (browserhost_resize );
Resize event processing:
Void Browserhost_resize ( Object Sender, eventargs E) {
Double XScale = Browserhost. actualwidth / This . Width;
Double Yscale = Browserhost. actualheight / This . Height;
Scaletransform Scale = New Scaletransform ();
Scale. scalex = XScale;
Scale. scaley = Yscale;
Rendertransform = Scale;
}
Convert the height and width of silverlighthost to 100% so that Silverlight control scales automatically with HTML.
Modify properties: width: "100%", height: "100%" in createsilverlight"
TheCodeThe test is successful in IE7. Click here to download the demo.
for Firefox:
Delete, previous . If not deleted although there is no problem on IE, it cannot run normally on Firefox, because Firefox encounters , the HTML size will be different