How do i change the image on a treeview when clicking the open/Expand button

leslie cox 0 Reputation points

i have a treeview that is using a HeaderToImageConverter class when the program runs the directory images and folders and files all show as expected, but when i expand a folder i cannot work out how to change the closed folder image to an open folder image.

Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
6,771 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 43,231 Reputation points

    Hello there,

    1). Add an ImageList Control to your WinForm.

    2). Populate the ImageList with the pictures/icons you wish to change/display in response to what the user does at run-time with the TreeView, such as expanding, or collapsing nodes.

    3). Assign the 'ImageList Control to the 'ImageList property of the 'TreeView

    Hope this resolves your Query !!

    --If the reply is helpful, please Upvote and Accept it as an answer--

    0 comments No comments