根据浏览器的大小,自动调整Silverlight的大小 2.0Beta1版

主要问题是
BrowserHost.Resize已经改为Application.Current.Host.Content.Resized
BrowserHost.ActualWidth改为Application.Current.Host.Content.ActualWidth
别的一样
改后的代码:(在cnblogs里找的)
Application.Current.Host.Content.Resized += new EventHandler(Content_Resize);
void Content_Resize(object sender, EventArgs e) {
           
double xscale = Application.Current.Host.Content.ActualWidth / this.Width;
          
double yscale = Application.Current.Host.Content.ActualWidth / this.Height;
           ScaleTransform scale 
= new ScaleTransform();
           scale.ScaleX 
= xscale ;
            scale.ScaleY 
= yscale ;
            RenderTransform 
= scale;
        }
标签: silverlight
posted @ 2008-04-14 23:14 zyshang 阅读(282) 评论(0) 编辑 收藏