onsdag, juli 06, 2011

Finding the true size of the Silverlight object

I wanted to find the true width and height in pixels of the Silverlight object in the HTML page. I did however not find any information on the Web that worked for me. This is the solution that I found myself, add the following code to your App.xaml.cs file and pass the size to the main page:


void Application_Startup(object sender, StartupEventArgs e)
{
   var width = Host.Content.ActualWidth;
   var height = Host.Content.ActualHeight;

   RootVisual = new MainPage(e.InitParams, width, height);
}

0 kommentarer:

Legg inn en kommentar