Customizing the Tree view in Silverlight 3: Part II

In this article we will see how to modify tree view using hierarchical data source in expression blend and how to work with the events.


Overview:

In my earlier post we saw how to create a tree view using hierarchical data source and how to modify it. In this post we will see how to modify it in expression blend and how to work with the events.

The workouts:

I modified my project little bit and the final output is like this now:

image1.gif

Now let's open MainPage.xaml in expression blend. After LayOutRoot in the Objects and Timeline tab you will see a new control has been created which is a treeview. First name it myTreeViewControl.

Now to modify this control right click onto it and go to Edit Additional Template->Edit Curent iems->Edit Current

image2.gif

That's it. Now you have all the properties of Image and TextBlock control. Edit as per as your requirement. For this project I resized the Image Control and made the stretch property as Fill and made the textblock's text alignment to center. The output will be like this now:

image3.gif

Conclusion:

That's it. You successfully modified the System.Wnidows.Controls tree view. Similarly you can create ListBox, ComboBox using the DataSource property. Try those out. In my next post I will discuss how to work with this tree view and the complete source code.