Creating Navigation Structures in Silverlight (Silverlight TV #38)

Download this episode

Download Video

Description

In the first of 2 navigation videos we filmed, David Poll joins John Papa to demonstrate how the Silverlight navigation API can be used to solve common navigational structures. David explains how navigation works with Silverlight, how it integrates with the Silverlight templates, and demonstrates how you can expand on its features using custom content loaders.

Relevant links:

Follow us on Twitter @SilverlightTV or on the web at http://silverlight.tv/ 

Registration for PDC10 is now open, and space is limited – don’t miss this opportunity to experience the PDC in Redmond. Join the PDC email newsletter for the latest information about PDC10.

Embed

Format

Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • User profile image
      Gigy

      Good Tutorial and clearly explained

    • User profile image
      CrispYY

      Althou I felt familiar with the navigation framework I just picked up some parts new to me. Thanks for this great show!

    • User profile image
      koolraaga

      Thank you David and John for another Excellent TV Episode.

       

      SLTV Rocks !!!

       

      KRK

    • User profile image
      gcadmes

      Excellent video, thanks for posting it.

       

      Question about the INavigationContentLoader.  Can more than one custom ContentLoader be specified in Xaml where the Frame is defined? I think I recall an error indicating that the <navigation:Frame.ContentLoader> can only be set once.  Surly there is a way to use multiple content loaders; Errors, authentication...etc.

       

      thanks again,


      Greg

    • User profile image
      david.poll

      Greg,

       

      It's not possible "by default".  However, take a look at some of my ContentLoader posts on my blog.  I have ContentLoaders that delegate to other ContentLoaders, allowing them to be chained together to "decorate" the loading behavior with error handling, authentication, etc.  Thankfully, these ContentLoaders compose reasonably well, so you can really create some expressive declarative definitions of navigation behavior.

       

      ContentLoader-related posts

       

      Let me know if you have any questions!  I'll be happy to try to help! Smiley

       

      -David Poll

    • User profile image
      Ben Hayat

      One thing for the next video would be nice to cover, is when a page is loaded in a frame and then within that page, there might be links to load other pages into the frame. Another words, instead of from outside of the frame to load a page, but rather a loaded page can load another page to replace itself in the frame.

       

      Secondly, is ContentLoader covered in WP7?

    • User profile image
      chris81

      Hello, great article but in SL4 i can see many article with design pattern mvvm which a best practise, why you don't use it ?

    • User profile image
      jv9

      Great video. It's really useful.

    • User profile image
      david.poll

      Chris,

       

      It's certainly possible to use MVVM with all of this -- the main reason it's not used here was because of time/simplicity constraints on the quick demo.

       

      -David

    • User profile image
      david.poll

      Ben,

       

      Thanks for the suggestion.  To answer your questions (since I don't know all of what Karl will go into in the next video):

       

      Links within a page -- this is actually quite straightforward.  HyperlinkButton (and Hyperlink for use in RichTextBox) searches its neighbors and up its visual tree for an INavigate (which Frame implements).  If no TargetName is given, it will navigate the first INavigate it encounters.  As a result, within a page, you just need to use a HyperlinkButton with no TargetName set (e.g. <HyperlinkButton NavigateUri="/Views/SomePage.xaml" Content="Navigate to some page" />), and clicking this will navigate the frame to another page.  If you need to accomplish this in code, within the page you can write this.NavigationService.Navigate(new Uri("/Views/SomePage.xaml", UriKind.Relative)).

       

      As for WP7 and ContentLoaders, since WP7 is based on Silverlight 3 and ContentLoaders were not introduced until Silverlight 4, as far as I know WP7 does not support ContentLoaders.

       

      -David

    • User profile image
      Ben Hayat

      David, it's always nice to see you!~

       

      Thanks for the reply. I brought up those points for some of the new comers, but I wasn't aware of WP7 missing ContentLoaders, since they always say WP7 is a "Superset" of SL3. So it's kind of a mystery what "Superset" means Smiley

      Man WP7 V2 better be alligning with SL5 to have full support for LINQ and some other important parts.

       

      Aren't you going to do part 2?

    • User profile image
      Shayzer

      David,

      I am still trying to figure out how best to use the navigation framework with Prism and the idea of Regions which provide place holders for views that reside within discrete prism modules. Have you any thoughts on the subject

       

      regards

       

      Shayzer

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.