I have a simple app that I'd like to change the size of when I load the contents.
For example, let's say I load an image of size 100.
How do I change the size of the container in which the silverlight is being rendered?
I have a simple app that I'd like to change the size of when I load the contents.
For example, let's say I load an image of size 100.
How do I change the size of the container in which the silverlight is being rendered?
Solution--
Rather than going through the page, you need to go through the browser object.
Here's the solution I found:
width = 200;
height = 200;
var host = HtmlPage.Document.HtmlPage.Plugin.Id);
host.SetStyleAttribute("width", width.ToString());
host.SetStyleAttribute("height", height.ToString());
The once the container is resized you can get notified:
public Page()
{
InitializeComponent();
App.Current.Host.Content.Resized += (s, e) =>
{
// Place here your layour resize code...
this.Width = App.Current.Host.Content.ActualWidth;
this.Height = App.Current.Host.Content.ActualHeight;
};
}