# ?SizeChanged Event for a Silverlight 4 out-of-browser application?

**URL:** <https://forum.kirupa.com/t/sizechanged-event-for-a-silverlight-4-out-of-browser-application/326513>\
**Category:** Uncategorized\
**Created:** [December 20, 2011, 12:27pm UTC](https://forum.kirupa.com/t/sizechanged-event-for-a-silverlight-4-out-of-browser-application/326513 "2011-12-20T12:27:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sk8er](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@Sk8er](https://forum.kirupa.com/u/Sk8er)\
**Post date:** [December 20, 2011, 12:27pm UTC](https://forum.kirupa.com/t/sizechanged-event-for-a-silverlight-4-out-of-browser-application/326513/1 "2011-12-20T12:27:36Z")

</div>

Hi everyone,

i am stuck in a fairly simply thing :puzzle: but im really new in programming!  
i would really appreciate if someone could help me understand it.

i have a Silverlight 4 out-of-browser application and I want to set a minimum width and height for it.

Lets assume i have the following code:

namespace test  
{  
public partial class MainPage : UserControl  
{  
public MainPage()  
{  
InitializeComponent();  
this.SizeChanged +=new System.Windows.SizeChangedEventHandler(MainPage\_SizeChanged);  
}

```
    private void MainPage_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
    {
        if (MainPage. **MainWindow**.Width &lt;240)
            MainPage. **MainWindow**.Width =240;

        if (MainPage. **MainWindow**.Height &lt;480)
            MainPage. **MainWindow**.Height =480;
    }

}

```

}

what is my \*\*MainWindow \*\*and how do i find it?
