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

leslie cox 0 Reputation points
2023-04-30T13:45:25.5033333+00:00

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.
9,598 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 44,316 Reputation points
    2023-05-02T11:39:15.36+00:00

    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

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.