I have hosted my silverlight service on the server. I have created a client application on my local machine referencing the silverlight service on the server. Everything compiles and work fine.
Now I coped the xap file into another silverlight application and tried to read the xap using the following code.
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);
Everything works fine. Now I added Navigation Framework to my application.
I modified the main page with navigation framework. In my main page I have
<navigation:Frame x:Name="ContentFrame" Source="/Views/abc.xaml" Grid.Row="1" >
When I Copy the modified xap on to the other application. It complains No xaml is found at the location /Views/abc.xaml.
Any help will be highly appreciated.
This answer is pretty comprehensive
But... if dynamic XAP loading is your thing, do yourself a favour and take a look at Jounce - It's an MVVM framework, but that doesn't mean you absolutely must use ViewModels.