Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 709107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:28:00+00:00 2026-05-14T04:28:00+00:00

I have a treeView with many nodes. I want that some nodes change their

  • 0

I have a treeView with many nodes. I want that some nodes change their image when node collapsed/expanded. How can I do it ?

Unfortunately, TreeNode don’t have properties like ExpandNodeImage, CollapseNodeImage \

TreeView can change very often, so nodes can be deleted/added.. i can delete child nodes and so on…

Maybe, there is a class like ExpandAndCollapseNode ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:28:01+00:00Added an answer on May 14, 2026 at 4:28 am

    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

    At this point you may want to make an initial pass over the TreeView, assuming it is populated, assigning the Node.ImageIndex property to point to the Image … in the ImageList … you want to use for the Node depending on whether it has children, or whatever.

    4). If a user expands a Node, for example, you can use the BeforeExpand Event of the TreeView to change the Node’s picture : like so : in this case we use the index of the Picture in the ImageList :

        private void treeView1_BeforeExpand(object sender, TreeViewCancelEventArgs e)
        {
            e.Node.ImageIndex = 3;
        }
    

    5) You can also set the Node’s image by using the ImageKey property which is the string name of the Image

    6) There lots of other possible Node Picture variations to use : check out : SelectedImageIndex and SelectedImageKey : You can change Node pictures in the BeforeSelect, AfterSelect and BeforeExpand, events also, depending on the effect you are after.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a TreeView that has many nodes. I have a background worker that
I have a form tha contains a TreeView with many Textboxes in each node.
I have a treeview with nodes like this: Foo (1234), and want to allow
I have many nodes and some of them are under the screen's edge. Tho
I have treeview and a context menu that is shown for every node. One
I have TreeView control and I want to bind tree nodes' IsExpanded property to
i have treeview windows application how can i add image tooltip to treenode ..
I have a wpf application that displays a 'Node' as such: <TreeView HorizontalAlignment=Stretch Name=treeView1
I have treeview control with one level of parent and child nodes, each node
I have many nodes in the treeview like nodes it children, children of children....

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.