Load Page on TreeView Node Selection in Silverlight 3


Creating Silverlight Project

Fire up Visual Studio 2008 and create a new Silverlight 3 Project. Name it as LOBSL3.

image1.gif

Let's have a design for our MainPage.xaml.

image2.gif

As you see in above image we have two panes, the left pane would have the Tree View. And the right side pane would contain the target page.

So, let's add one.

image3.gif

So we have several nodes.

Our aim of this article is to load different pages on different TreeView node selection.

So let's have some pages.

Now in TreeViewItem's Selected event we need to clear the value of the Content Border and again set it to our target Page.
Like following:

code.gif

As simple as that, so let's run the application.

image4.gif

image5.gif

image6.gif

image7.gif

This article was requested by one of my article reader, I know it is a simple thing to do, but I gave with some sample so that it would clear.

Hope it helps.
 


Similar Articles