Deep linking is an unique feature of RadNavigation allowing you to use page navigation by simply changing the URL in the browser address bar. Now you can provide a link directly to every page from your application. Implementing this RadNavigation feature is just as easy as using the other navigation classes all you have to do is just follow the next steps:

 

1. Create Silverlight application.
In order to use deep linking in page navigation scenario you have to make sure that any changes in the state the page is reflected to the browser’s address (bookmark). To do this you have two choices:
 
-    If you do not want to use AjaxBrowserHistory (Back/Forward buttons of the browser) functionality set:
       
 NavigationService.UseBrowserHistory = true;  

-    Otherwise if you use browser history set :        
NavigationService. UseHistoryBookmark = true

 

 

For more information visit the help section.

 

In both cases you must set these properties to true before writing any other code in App.xaml.cs:

private void Application_Startup(object sender, StartupEventArgs e) 
        { 
             NavigationService.UseBrowserHistory = true
            // NavigationService.UseHistoryBookmark= true; 
            …. 
        } 

 2. The next step is to add some RadPage classes in your application.

3. After you have added all the pages and navigation structure between them then you are ready to use DeelLinking just go again in App.xaml.ca and add the following:

 

private void Application_Startup(object sender, StartupEventArgs e) 
        { 
            ….. 
            if (!NavigationService.LoadDeepLink()) 
            { 
                //Navigate to some page  
            } 
        } 

NavigationService.LoadDeepLink() method checks wheter you have deep linking or just want to navigate to some page.
So the final peas of code should look like the following:

 

private void Application_Startup(object sender, StartupEventArgs e) 
        { 
            NavigationService.UseBrowserHistory = true
            this.RootVisual = new RadFrameContainer(); 
            NavigationService service = NavigationService.GetNavigationService(); 
            if (!NavigationService.LoadDeepLink()) 
            { 
                service.Navigate(new Page1()); 
            } 
        } 

 

 RadNavigation framework uses the NavigationIdentifier  property of RadPage in order to change borwser bookmarks while navigating between pages. By default its value is set to the full name of the RadPage class. But if you prefer to use  can custom navigation identifiers or custom browser bookmarks.  You can also navigate to the same page but  with different content and different browser identifier.
The Silverlight application below shows how you can use all these features of the RadNavigation framework(The full source code you can find attached at the end of the blog post):


 

 BooksExample-source



Related Posts

Comments