This article is compatible with the latest version of Silverlight.
This tip is about adjusting the size of the Silverlight object in the Html to the size of the content in our Silverlight application. The example I will use will manipulate only the height, because the width can be manipulated in analogical way.
Let's start with explanation of how we're going to access the Silverlight object in the HTML. We use the HtmlPage object in the codebehind. With its help we invoke a javascript function, which will deal with Silverlight object in the mark up:
private void ResizeSilverlightOnject( double height )
{
HtmlPage.Window.Invoke( "ResizeObject", new object[] { height } );
}