asp.net.ph

TreeView.ImageSet Property

System.Web.UI.WebControls Namespace   TreeView Class


.NET Framework version 2.0

Sets or retrieves the group of images to use for a TreeView control.

Syntax


Script [ TreeViewImageSet enumValue = ] TreeView.ImageSet

Property Value


enumValue One of the TreeViewImageSet enumeration values.

The property is read/write with a default value of Custom.

Exceptions


Exception Type Condition
ArgumentOutOfRangeException The specified image set is not one of the TreeViewImageSet values.

Remarks

Use the ImageSet property to specify the group of images to use for the TreeView control. You can either select a predefined set of images to give the control a standard look or define your own custom set.

NOTE: The ImageSet property does not affect any style settings for a node. Set the appropriate style property, such as the NodeStyle property, if you want to add custom colors and spacing.

The following table lists the valid values for the ImageSet property.

Member Name Description
Arrows A predefined set of arrow images.
BulletedList A predefined set of diamond-shaped bullet images.
BulletedList2 A predefined set of square-shaped bullet images.
BulletedList3 A predefined set of sectioned, diamond shaped bullet images.
BulletedList4 A predefined set of alternate sectioned, diamond shaped bullet images in sizes that vary by level.
Contacts A predefined set of MSN Messenger–styled images.
Custom A user-defined set of images. This is the default value of the ImageSet.
Events A predefined set of event log–styled images.
Faq A predefined set of FAQ-styled images.
Inbox A predefined set of e-mail–styled images.
Msdn A predefined set of Microsoft MSDN developer program–styled images.
News A predefined set of newsgroup-styled images.
Simple A predefined set of simple-shaped outline images.
Simple2 A predefined set of filled simple-shaped images.
WindowsHelp A predefined set of Microsoft Windows Help–styled images.
XPFileExplorer A predefined set of Windows Explorer for Microsoft Windows XP–styled images.

When defining a custom set of images, you should specify an image for each of the properties in the following table. Otherwise, the default image for that property is used.

Property Description
CollapseImageUrl The URL to a custom image for the collapsible node indicator.
ExpandImageUrl The URL to a custom image for the expandable node indicator.
LineImagesFolder The URL to a folder that contains custom images for the lines that connect nodes.
NoExpandImageUrl The URL to a custom image for the non-expandable node indicator.

Example

The example below shows how to programmatically set the ImageSet property at run time, depending on user input. The code also demonstrates how simple it is to retrieve the available system image sets and dynamically add each to a selectable list.

<script language = "C#" runat = "server">
   void Page_Load ( Object src, EventArgs e ) {
      if ( !IsPostBack ) {
         ICollection borders = TypeDescriptor.GetConverter (
            typeof ( TreeViewImageSet ) ).GetStandardValues ( );
         foreach ( TreeViewImageSet b in borders ) {
            ImageSetSelect.Items.Add ( b.ToString ( ) );
         }
      }
      myTreeView.ImageSet = ( TreeViewImageSet ) ImageSetSelect.SelectedIndex;
   }
</script>

 Show me 

See Also

TreeView Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph