启用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中点击右键都会出现卸载选项。
posted @ 2009-11-07 17:06  Silver.Lee  阅读(146)  评论(0编辑  收藏  举报