开发者

How do we close and a Silverlight application in silverlight 4

开发者 https://www.devze.com 2023-03-15 19:25 出处:网络
I want to close and a silverlight application on the MenuClick event which I am handling in a helper class...

I want to close and a silverlight application on the MenuClick event which I am handling in a helper class...

if (Application.Current.IsRunningOutOfBrowser)
                    Application.Current.MainWindow.Close();

or

HtmlPage.Window.Invoke("close");

is not working.....

So if anyone has a diff solution or corrections to开发者_JAVA技巧 the above approch please answer me...


if (!Application.Current.IsRunningOutOfBrowser)
   HtmlPage.Window.Eval("window.open('','_self');window.close();");


If the app is running in-browser then the browser's rules regarding opening/closing windows will apply. Namely, you can only use a scripted command to close a window that was opened with a scripted command. If the user opened the window then you cannot close it with an Invoke command.

I've never tried to close an OOB app in code so I can't help you on that side of things.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号