How can I prevent the user from resizing the silverlight out-of-browser window?

↘锁芯ラ 提交于 2020-01-11 09:44:29

问题


I have a silverlight app which can be installed as out-of-browser.

I've defined the Height and Width in the main UserControl.

I've defined the same Height and Width in the OutOfBrowserSettings.xml file.

But the user can still resize the out-of-browser frame window. How do I prevent this?


回答1:


The window hosting the Silverlight application cannot be controlled by the application when it is running with normal permissions, that would be a security issue.

However, if you install the OOB application with elevated permissions, you can change the chrome of the window and define your own. This will prevent the resizing (except of course if you explicitly implement resizing with the custom chrome).

To change the chrome options, use the OOB Settings in the project properties.




回答2:


I did not want to give up the window border. This is not pretty, but here is what I am doing for now.

    Host.Content.Resized += new EventHandler(Content_Resized);
    ...
    void Content_Resized(object sender, EventArgs e)
    {
        if (IsRunningOutOfBrowser)
        {
            MainWindow.Width = 800;
            MainWindow.Height = 448;
        }
    }



回答3:


I don't think you can. It seems to be another one of those "User is King" choices.



来源:https://stackoverflow.com/questions/2682731/how-can-i-prevent-the-user-from-resizing-the-silverlight-out-of-browser-window

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