新建一个Silverlight应用程序,右键选择此项目的属性,把脱离浏览器项勾选(英文版的就是Enable running application out of the sbrower)

Silverlight学习之 out of browser

然后再后台编写代码,在页面加载的时候检测是否安装此应用程序。

if (Application.Current.InstallState == InstallState.NotInstalled)
            {
                Application.Current.Install();
            }

运行程序,右键单击页面会弹出提示框。点击安装此程序,弹出画面

Silverlight学习之 out of browser

点击确定后Silverlight程序将会安装到本机。

效果

Silverlight学习之 out of browser

关闭浏览器。点击桌面上的快捷方式后者从开始菜单中点击,就可以在本地运行刚才安装的程序了。

相关文章: