New Silverlight Video Tutorial: How to Create a Silverlight Paging System to Load new Pages

Toaday I got a comment from a blog reader named Fracisco…I think he wanted to know how to load new pages into a Silverlight website.  Just for him, and because I think many of you have the same problem, I made a video tutorial where I show you how to:

1. Create a Content Holder UserControl;

2. Make two pages called HomePage and AboutUs

3. In App.xaml load ContentHolder instead of MainPage.xaml (the default action of a SL app)

4. Create a SwitchContent method that takes a UserControl as its argument; this method will load the requested page into the ContentHolder control

5. Make a Nav UserControl that has Buttons that load the associated page into the ContentHolder UserControl

6. Add the Nav control to each page

7. Create EventHandlers in the Nav.xaml.cs to load the associated content into the ContentHolder User

8. VIOLA! You will then have a Silverlight paging system that loads any page, on Demand into your MainPage.xaml!


Working Example: (from the source code below)

My Project:

Video: (Running Time: 17 Minutes)

Hi Victor
I’m very new to blend and I need a very basic code to make that button call an hyperlink to create live buttons in blend to be used in Expressions 3 to call the other pages in my site, I try the help in blend (the sample code there only give an error at time to run it) and look in your book Expression blend 3 but I can’t find the answer to to this simple task. Can you help?

  1. As usual thank you for your step by step help.

  2. Is there a reason you didn’t use the Silverlight Navigation framework in the Silverlight SDK? It should allow you to accomplish this without needing any code — just HyperlinkButtons that point to the XAML files for the pages to load.

    • Yes David, you are correct; the Navigation framework does do this for you and I think it is a great feature. However, I always like to offer a “do it yourself” perspective to Silverlight developers. If a developer wants to make use of the Navigation framework that is great but I feel that a good SL developer should have the option and ability to do it his or her way and not be dependent upon someone else’s even if that someone else is Microsoft. If they like the way it is done for them then by all means they should partake; but I encourage any SL developer to at least know how to accomplish it on his or her own; this will only make them a better, more all-around, sought after Silverlight developer. Thanks for your post; it opened the door for something I have been wanting to voice for a while now.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: