Dim deploymentParts As List(Of XElement) = (From assemblyParts In deploymentRoot.Elements().Elements() Select assemblyParts).ToList()
Dim asm As System.Reflection.Assembly = Nothing
For Each xElement As XElement In deploymentParts
Dim source As String = xElement.Attribute("Source").Value
Dim asmPart As AssemblyPart = New AssemblyPart
Dim streamInfo As StreamResourceInfo = Application.GetResourceStream(New StreamResourceInfo(e.Result, "application/binary"), New Uri(source, UriKind.Relative))
If source = "Load.dll" Then
asm = asmPart.Load(streamInfo.Stream)
Dim service As New NavigationService
service = NavigationService.GetNavigationService
service.Navigate(asm.CreateInstance(
"Load.Page"))
End If
Next xElement
Do you have any examples or know of any that can help me with this problem? I need the browser forward and back buttons to be able to load the dynamic xap file.
Thanks
7 Answers, 1 is accepted
To dynamically load pages from different assemblies you can try this:
//Load the TestAssembly.dl assembly.
Uri packageUri = new Uri("TestAssembly.dll", UriKind.Relative);
StreamResourceInfo stream = System.Windows.Application.GetResourceStream(packageUri);
AssemblyPart assemblyPart = new AssemblyPart();
Assembly targetAssembly = assemblyPart.Load(stream.Stream);
this.service = NavigationService.GetNavigationService();
Type[] assemblyTypes = targetAssembly.GetTypes();
foreach (var type in assemblyTypes)
{
Type[] typeInterfaces = type.GetInterfaces();
//HomePage is a page from TestAssembly.dll assembly.
if (type.Name == "HomePage")
{
RadPage page = (RadPage)targetAssembly.CreateInstance(type.FullName);
this.service.Navigate(page);
break;
}
}
After that Back/Forward navigation should work as expected.
It is important to correctly load the assembly in order to have the access to its pages.
I hope this answers your question.
Regards,
Boryana
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
My RadPage is in a separate XAP file in the client bin along with the main application XAP file. Is this sample code for a RadPage in a XAP file or for a RadPage in a Resource?
Here are the navigation strings.
This is the main page in the main xap file (Navigate.xap):
http://localhost:1808/NavigateTestPage.aspx#tkagnav=Navigate.MainPage
This works fine.
This is the downloaded page in the second xap file (Load.xap):
http://localhost:1808/NavigateTestPage.aspx#tkagnav=Load.Page
This works fine.
I hit the browser back button:
http://localhost:1808/NavigateTestPage.aspx#tkagnav=Navigate.MainPage
This works fine.
Then I hit the browser forward button:
http://localhost:1808/NavigateTestPage.aspx#tkagnav=Load.Page
But this page doesn't display. It stays on the main page. It is like the Load.Page is not placed in the cache.
Thanks
Thank you for reporting this issue. For now Back and Forward functionality in the RadNavigation framework
can be used only if you have navigation between pages that are in the same XAP file. It is possible to navigate to page from a different XAP, however you will have to implement your own custom logic in order to have Back/Forward functionality between pages from different XAP files.
We will add multiple XAP support to RadNavigation as soon as possible.
To implement your own back/forward functionality you have to navigate between the pages using page instants , not page string representation. For example you could try this:
RadPage page = assemblyPart.CreateInstance("SilverlightApplication1.MasterPage1") as RadPage;
this.service.Navigate(page);
Best wishes,
Boryana
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Hi,
I am wondering if you have added multiple XAP support to RadNavigation yet.
Thanks
Michael
Unfortunately the feature is not implemented yet because of a trend to phase out the RadNavigation framework in favor of the MS navigation framework.
In Silverlight 3, the built-in navigation can offer tight tool integration like with Blend 3 (Sketch Flow and its player for example). Unfortunately we would not be able to match the same tool integration as even Blend 3 is not very extensible. Also we expect that the built-in navigation will evolve with new features that we will be unable to support.
Greetings,
Miroslav
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Thanks Miroslav,
I guess I will be using the MS navigation in Silverlight 3.0.
The only drawback is you guys are a lot better at support than Microsoft.
Let us know if you face any problems with the MS navigation system - we will be glad to help!
All the best,
Valentin.Stoychev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
