问题
Is there a way to set a minimum width and height for my Silverlight 4 out-of-browser application?
回答1:
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;
回答2:
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.
来源:https://stackoverflow.com/questions/7215421/how-do-i-set-a-minimum-width-and-height-for-my-silverlight-4-oob-application