Question

Is there a way to set a minimum width and height for my Silverlight 4 out-of-browser application?

Was it helpful?

Solution

There are no built in settings to control the window Minimum Width and Height so you will need to handle it with code.

First of all your OOB app needs to have Elevated Trust.

You then need to attach a handler the SizeChanged event of the FrameworkElement being used for the application's RootVisual (usually MainPage.xaml).

In the handler include code like this:-

 if (Application.MainWindow.Width < myMinWidth)
     Application.MainWindow.Width = myMinWidth;

 if (Application.MainWindow.Height < myMinHeight)
     Application.MainWindow.Height = myMinHeight;

OTHER TIPS

You can set directly properties only... You can set properties of Window with minimum and maximum. or else you can programmatically set it in PageLoad/form load Event.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top