从webclient读取xap文件

时间:2012-08-03 15:04:26

标签: silverlight webclient xap

我在服务器上托管了我的silverlight服务。我在本地计算机上创建了一个客户端应用程序,引用服务器上的silverlight服务。一切都编译好了。

现在我将xap文件应用到另一个silverlight应用程序中并尝试使用以下代码读取xap。

     StreamResourceInfo _streamResourceInfo = new StreamResourceInfo(e.Result, null);
        StreamResourceInfo _streamResourceInfoDll = Application.GetResourceStream(_streamResourceInfo,
                                          new Uri(string.Format("{0}.dll", abc), UriKind.Relative));
        AssemblyPart _assemblyPart = new AssemblyPart();
        Assembly _assembly = _assemblyPart.Load(_streamResourceInfoDll.Stream);
        UserControl _userControl = _assembly.CreateInstance(string.Format("{0}.MainPage", abc)) as UserControl;
        this.Main_Canvas.Children.Add(_userControl);

一切正常。现在我将Navigation Framework添加到我的应用程序中。

我用导航框架修改了主页面。在我的主页中我有

     <navigation:Frame x:Name="ContentFrame" Source="/Views/abc.xaml" Grid.Row="1" >

当我将修改后的xap复制到另一个应用程序时。它抱怨在/Views/abc.xaml位置找不到xaml。

任何帮助都将受到高度赞赏。

1 个答案:

答案 0 :(得分:0)

This answer is pretty comprehensive

但是......如果动态XAP加载是你的事情,请帮个忙看看Jounce - 它是一个MVVM框架,但这并不意味着你绝对必须使用ViewModels。

相关问题