• Home
  • Registration
  • Articles
  • Code Snippets
  • Videos
  • Message Board
  • Contact Us
  • About Us
  • Search
 
Home
Tree View In Silverlight 3 Application PDF Print E-mail
Silver Light - Controls
Written by Diptimaya Patra   
Tuesday, 01 September 2009 09:33
Introduction
In this article we will explore about Tree View control in Silverlight 3.

Creating Silverlight Project

Fire up Visual Studio 2008 and create a Silverlight Application. Name it as TreeViewSL3.

Image Loading...

 

 

The TreeView control displays data in a hierarchical manner. Open the solution in Expression Blend 3.
Go ahead and a Tree View control to your application.I have changed the Background to Linear Brush.
To add TreeView Item to the Tree View, just right click on it and add TreeViewItem.

 

Image Loading...

 

Add several, and if you want to add children of any parent then select the particular TreeViewItem and add another Treeview Item.
I have created the below hierarchy:

Image Loading...

 

If you see the design view it will look similar to the following:

 

Image Loading...

 

 

Here is the XAML code behind for the TreeView:



<controls:TreeView x:Name="MyTreeView" HorizontalAlignment="Left" Width="197" Margin="0,0,0,202">
 <controls:TreeView.Background>
 <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
 <GradientStop Color="Gray" Offset="0"/>
 <GradientStop Color="White" Offset="1"/>
 </LinearGradientBrush>
 </controls:TreeView.Background>
 <controls:TreeViewItem Margin="0" Header="Item 1">
 <controls:TreeViewItem Margin="0" Header="Sub Item 1"/>
 </controls:TreeViewItem>
 <controls:TreeViewItem Margin="0" Header="Item 2">
 <controls:TreeViewItem Margin="0" Header="Sub Item 1"/>
 <controls:TreeViewItem Margin="0" Header="Sub Item 2"/>
 </controls:TreeViewItem>
 <controls:TreeViewItem Margin="0" Header="Item 3">
 <controls:TreeViewItem Margin="0" Header="Sub Item 1">
 <controls:TreeViewItem Margin="0" Header="Sub Item 1"/>
 </controls:TreeViewItem>
 </controls:TreeViewItem>
 </controls:TreeView>



Now if you run the application you can expand or collapse a particular TreeViewItem.

Image Loading.....

 

Conclusion

This article is very basic to understand the Tree View Control in Silverlight 3. We will explore more on this in forth coming articles.


Enjoy Coding.


About the Author


Diptimaya Patra

Description :I am a Master in Computer Application (MCA) from SRM University, Chennai. I am MCTS in ASP.Net Web Development, and MOSS 2007 Administration. I have extreme exposure to Microsoft Technologies in recent times like Silverlight 2, Silverlight 3. I am from Cuttack, Orissa. You can reach me using this mail (diptimaya.patra@gmail.com). Currently I am working as a Software Engineer in UST Global Inc in Trivandrum Center.

Occupation :Software Engineer
Company : UST Global.
Location : India
Follow me at twitter : http://twitter.com/dpatra


  • Add New
Comments (1)
  • |122.165.56.xxx |2009-12-11 13:54:59 Balaji  - Thanks for sharing
    Reply
Write comment
Your Contact Details:
Comment:
Security
Security Image
Please input the anti-spam code that you can read in the image.
Powered by !JoomlaComment 4.0 beta2
Last Updated on Tuesday, 01 September 2009 09:39
 
Our valuable member Diptimaya Patra has been with us since Monday, 13 July 2009.
Show Other Articles Of This Author
  • Page Transition In Silverlight 3 Navigation Application
  • Selecting Tree View Nodes In Silverlight 3 Application
  • ScrollIntoView In DataGrid In Silverlight 3 Application
  • Scrollable Stack Panel In Silverlight 3 Using Blend 3
  • Row Detail In DataGrid In Silverlight 3 Application
  • Resource Dictionary In Silverlight 3 Using Blend 3
  • Radio Button Groping In Silverlight 3
  • Radio Button Groping In Silverlight 3
More articles :
» Common issues to ASP.NET input controls for Enabled / Visible / ReadOnly Properties
» Page Transition In Silverlight 3 Navigation Application
» Selecting Tree View Nodes In Silverlight 3 Application
» Rich Text Box in Silver Light 4.0
» ScrollIntoView In DataGrid In Silverlight 3 Application
Ads by Lake Quincy Media
Contact Us | Terms & conditions | Privacy Policy

© 2009 CodeGain.com All Rights Reserved