How do I set a minimum width and height for my Silverlight 4 OOB application?

此生再无相见时 提交于 2020-01-03 18:59:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!