R – How to simulate paging in Silverlight 2.0

silverlight-2.0

I am trying to workout how my silverlight application is going to work.

I want it to fill the browser.

I will have a like home page that will allow login.

Then it will open up a search page to list data

And then on selection goto the detail page of selected item.

But my question is how do I structure the app to goto these "pages"
as I call them.

Do I have a user control for each logical page and then load that
user control?

How is that done in the code loading user controls could you explain please?
Does there have to be a base user control???

Malcolm

Best Answer

The easiest way to go about it in Silverlight 2.0 is to put a ContentControl in your Page, along with navigation controls (a menu or some buttons to select pages if you have several root pages).

Each "Page" is created as a user control, and you display it by setting the Content property of the contentcontrol to an instance of your usercontrol.

So, for example: Page (inherits from UserControl, created by VS): contains a ContentControl, named MainContent

Login (inherits from UserControl) Search (inherits from UserControl) Details (inherits from UserControl) etc

When going from search to Details, for example, if Details takes the Id of the object to be displayed: MainContent.Content = New Details(SelectedItem.Id)

Let me know if you need more details, depneding on your proficiency with xaml and silverlight.

Side Note: Silverlight 3 comes with a built-in mechanism for that, but that's not gonna elp you right now.

EDIT: The Silverlight afficionados will have noted that there is no "Page" class in Silverlight 2.0, I was talking about the class named "Page" created by VS, which is a UserControl. I corrected my entry