TreeList.GetSelectImage Event
Allows you to dynamically assign select images to nodes.
Namespace: DevExpress.XtraTreeList
Assembly: DevExpress.XtraTreeList.v19.1.dll
Declaration
Event Data
The GetSelectImage event's data class is GetSelectImageEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
FocusedNode | Gets or sets a value indicating whether a node is focused. |
Node | Gets the current Tree List node. Inherited from NodeEventArgs. |
NodeImageIndex |
Gets or sets the index of the node’s image in a source image list. When handling the TreeList.GetStateImage event, the source of images is specified by the TreeList.StateImageList property. When handling the TreeList.GetSelectImage event, the source of images is specified by the TreeList.SelectImageList property. Inherited from GetStateImageEventArgs. |
Remarks
Tree List nodes can display select and state images.
The GetSelectImage event allows you to dynamically assign select images to nodes. Other ways to specify select images are covered in the TreeList.SelectImageList topic.
Before handling the GetSelectImage event, specify the source of select images with the TreeList.SelectImageList property.
The GetSelectImage event fires for each node within the Tree List. Parameters passed to your event handler allow you to identify the currently processed node, determine whether it is focused and assign the index of a required image from the source image list to the node.
Example
This code provides an example of handling the TreeList.GetSelectImage
event used to assign select images to nodes. A green dot glyph is assigned to non-focused nodes, and a red dot glyph is assigned to the focused node. Note that an image list containing these glyphs must be assigned to the TreeList.SelectImageList property.
using DevExpress.XtraTreeList;
private void treeList1_GetSelectImage(object sender, GetSelectImageEventArgs e) {
if (e.FocusedNode)
e.NodeImageIndex = 2;
else
e.NodeImageIndex = 0;
}