windowsforms-devexpress-dot-xtratreelist-dot-treelist-4fc67ea5.md
Gets or sets the source of select images for nodes.
Namespace : DevExpress.XtraTreeList
Assembly : DevExpress.XtraTreeList.v25.2.dll
NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.TreeList
[DefaultValue(null)]
public object SelectImageList { get; set; }
<DefaultValue(Nothing)>
Public Property SelectImageList As Object
| Type | Default | Description |
|---|---|---|
| Object | null |
An object that represents the source of select images.
|
Nodes can display the following icons:
The TreeList.SelectImageList property specifies an ordered (indexed) collection that stores images. You can use the following image collections:
To specify the index of the image displayed in a particular node, use the following properties and events:
the TreeList.ImageIndexFieldName property — specifies the name of the data field that contains image indexes. The property specifies the image index for both non-focused and focused states (you cannot use data source fields to specify two icons).
the TreeListNode.ImageIndex and TreeListNode.SelectImageIndex properties — get or set the node’s image index in the non-focused and focused states, respectively. Images are automatically changed when a node gets / loses the focus.
the TreeList.GetSelectImage event — fires before a node is displayed and allows you to specify (override) the image index for the processed node.
If the index is out of range, no image is displayed.
The TreeList.RowSelectImageClick event fires when a select image is clicked.
The code below shows how to assign select and state images to nodes.
using DevExpress.XtraTreeList.Nodes;
// Data source for select (left) images.
treeList1.SelectImageList = imageCollection1;
// Use the data source to assign select images to nodes.
// Data source fields do NOT allow you to specify
// two images that depend on the focus.
// This property has priority over the node's
// ImageIndex and SelectImageIndex properties.
treeList1.ImageIndexFieldName = "ImageIndex";
// Data source for state (right) images.
treeList1.StateImageList = imageCollection1;
// Use the Load event to assign images to nodes.
treeList1.Load += TreeList1_Load;
private void TreeList1_Load(object sender, EventArgs e) {
foreach (TreeListNode node in treeList1.Nodes) {
// The left image displayed when the node is NOT focused.
node.ImageIndex = 0;
// The left image displayed when the node is focused.
node.SelectImageIndex = 1;
// The right image that does not depend on the focus.
node.StateImageIndex = 2;
}
}
Imports DevExpress.XtraTreeList.Nodes
' Data source for select (left) images.
treeList1.SelectImageList = imageCollection1
' Use the data source to assign select images to nodes.
' Data source fields do NOT allow you to specify
' two images that depend on the focus.
' This property has priority over the node's
' ImageIndex and SelectImageIndex properties.
treeList1.ImageIndexFieldName = "ImageIndex"
' Data source for state (right) images.
treeList1.StateImageList = imageCollection1
' Use the Load event to assign images to nodes.
AddHandler treeList1.Load, AddressOf TreeList1_Load
Private Sub TreeList1_Load(ByVal sender As Object, ByVal e As EventArgs)
For Each node As TreeListNode In treeList1.Nodes
' The left image displayed when the node is NOT focused.
node.ImageIndex = 0
' The left image displayed when the node is focused.
node.SelectImageIndex = 1
' The right image that does not depend on the focus.
node.StateImageIndex = 2
Next node
End Sub
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SelectImageList property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
winforms-treelist-virtual-mode/CS/ExampleMainForm.cs#L30
MyTtreeList.SelectImageList = imageListForTree;
MyTtreeList.DataSource = new object();
winforms-treelist-virtual-mode/VB/ExampleMainForm.vb#L22
newColumnDescription.VisibleIndex = 0
MyTtreeList.SelectImageList = imageListForTree
MyTtreeList.DataSource = New Object()
See Also