Multiple Paths in Path ListBox in Silverlight 4


Introduction

In this article we will see how multiple paths can be used in PathListBox control in Silverlight 4.

Creating Silverlight Project

Fire up Visual Studio 2010 and create a new Silverlight Application Project. Name it as MultiplePathSample.

1.gif

Let's draw some paths. 

I have used Expression Designer to draw paths, as it's kind of difficult to draw better paths in Blend.

Copy the path design from Expression Designer and paste in Blend.

I have created 3 different paths as displayed below.
 
2.gif 
3.gif

Now let's add a PathListBox to the Layoutroot.

4.gif 

As I said in earlier post. Don't think about it's position of the PathListBox control. Wherever the paths would be the that is it's position.

5.gif 

Now let's add these 3 paths to the PathListBox.

6.gif
 
Once you add paths to the PathListBox, the paths would be named automatically, such as in our case path, path1 and path2. 

You can even name the paths first and then add, there is no conflict in that.

Now let's add some sample data to the PathListBox.

7.gif
 
Now let's run the application and here it is all the items are added to the paths automatically.

8.gif 

Hope this article helps.

Up Next
    Ebook Download
    View all
    Learn
    View all