Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Binding TreeView Control to an Arraylist

Binding TreeView Control to an Arraylist

Scheduled Pinned Locked Moved C#
wpfwcftutorialquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    KKrista
    wrote on last edited by
    #1

    Hi, I am developing application in which an Arraylist has a list of users. I also have a TreeView to show the users in the list. Can anyone tell me how to bind the TreeView Control to the Arraylist?

    Thanks in advance, Murali

    M 1 Reply Last reply
    0
    • K KKrista

      Hi, I am developing application in which an Arraylist has a list of users. I also have a TreeView to show the users in the list. Can anyone tell me how to bind the TreeView Control to the Arraylist?

      Thanks in advance, Murali

      M Offline
      M Offline
      Manoj Kumar Rai
      wrote on last edited by
      #2

      Murali, If you want to use a tree view then one way i can suggest is that, you you populte the tree view like below: Suppose "tvw" is the tree view. TreeNode ndRoot = new TreeNode(stringUserName); tvw.Nodes.Add(ndRoot); this way you can add all ur users in the tree view. Manoj

      Manoj Never Gives up

      K 1 Reply Last reply
      0
      • M Manoj Kumar Rai

        Murali, If you want to use a tree view then one way i can suggest is that, you you populte the tree view like below: Suppose "tvw" is the tree view. TreeNode ndRoot = new TreeNode(stringUserName); tvw.Nodes.Add(ndRoot); this way you can add all ur users in the tree view. Manoj

        Manoj Never Gives up

        K Offline
        K Offline
        KKrista
        wrote on last edited by
        #3

        Hi Manoj, Thanks for your reply. I am able to add nodes into the tree view without any problem. However, I want to bind an Arraylist to the TreeView so that the TreeView is controlled whenever the Arraylist is modified (Addition/Deletion of Users). Is that possible?

        Thanks in advance, Murali

        Z 1 Reply Last reply
        0
        • K KKrista

          Hi Manoj, Thanks for your reply. I am able to add nodes into the tree view without any problem. However, I want to bind an Arraylist to the TreeView so that the TreeView is controlled whenever the Arraylist is modified (Addition/Deletion of Users). Is that possible?

          Thanks in advance, Murali

          Z Offline
          Z Offline
          zaboboa
          wrote on last edited by
          #4

          TreeView control does not support databinding. What you can do, is have an event handler on the ArrayList, and every time you add, or remove an element from the array, you can repopulate the treeview control. Hope that helps.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups