启用silverlight3的out of browser

时间:2022-04-29
本文章向大家介绍启用silverlight3的out of browser,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

启用silverlight3的out of browser

启用out of browser需要修改项目中Properties文件夹下的AppManifest.xml文件

<Deployment 
  xmlns="http://schemas.microsoft.com/client/2007/deployment"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <Deployment.Parts>
  </Deployment.Parts>
  <Deployment.ApplicationIdentity>
    <ApplicationIdentity
        ShortName="Out of Browser"
        Title="This app is out of the browser!">
      <ApplicationIdentity.Blurb>
        Sample Out of the Browser App
      </ApplicationIdentity.Blurb>
    </ApplicationIdentity>
  </Deployment.ApplicationIdentity>
</Deployment>

在写了一下out of browser的判断

public MainControl()
{
// Required to initialize variables
InitializeComponent();
            App.Current.Host.Content.Resized += new EventHandler(Content_Resized);
            this.Loaded += new RoutedEventHandler(MainControl_Loaded);
}

        void MainControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (App.Current.RunningOffline) {
                xTxt.Text = "out of browser";
            }
        }

        void Content_Resized(object sender, EventArgs e)
        {
            this.Width = App.Current.Host.Content.ActualWidth;
            this.Height = App.Current.Host.Content.ActualHeight;
        }

运行程序的界面

右键点击

选择安装out of browser

运行效果

卸载也很方便 不管是在浏览器 还是 在 out of browser中点击右键都会出现卸载选项。