首页 新闻 会员 周边

silverlight2.0跳转问题

0
[已解决问题] 解决于 2008-09-28 15:02

2.0 不支持InitializeFromXaml(xaml) 方法了。

 

在写Application.LoadComponent(this, new Uri("MyControl.xaml", UriKind.Relative));
    FrameworkElement fe = this.Content;

MyControl.xaml为  Embedded Resource

报错。Error 1 Cannot implicitly convert type 'System.Windows.UIElement' to 'System.Windows.FrameworkElement'. An explicit conversion exists (are you missing a cast?) 

F:\SilverLight开发\silverlight英文视频\Creat 3D Image\SLCreate3DImageDemo\SLCreate3DImageDemo\CubeControl.xaml.cs 37 35 SLCreate3DImageDemo

越~、。的主页 越~、。 | 初学一级 | 园豆:0
提问于:2008-09-27 15:27
< >
分享
最佳答案
0

因为this.Content是一个类型为UIElement的对象,应该写成

UIElement ue = this.Content;

当然你可以尝试着强制类型转换

FrameworkElement fe = (FrameworkElement)this.Content;

Gray Zhang | 专家六级 |园豆:17610 | 2008-09-27 20:25
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册