Search code examples
c#silverlightwindowmaximize

Maximize size of Silverlight content after it has loaded


I have an HTML page containing Silverlight content. The window initially opens minimized. If I maximized the window while the Silverlight content is being loaded, the Silverlight Application opens with the full screen size. But If I waited till the Silverlight application has loaded then I tried to maximize the browser window, the Silverlight size is not refreshed and stays small.

How can I refresh the size of the Silverlight application after maximizing the browser window ?


Solution

  • Used the answer here :

    public Page()

    { InitializeComponent();

    App.Current.Host.Content.Resized +=newEventHandler(Content_Resized); }

    void Content_Resized(object sender, EventArgs e) {

    this.Width =App.Current.Host.Content.ActualWidth; this.Height =App.Current.Host.Content.ActualHeight;

    }