CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2007
    Posts
    6

    Make a copy of a treeviewitem without parent

    In my application I have a TreeView with a number of TreeViewItems. The TreeView is shown in a Grid.
    What I want to do is add a selected TreeViewItem to another Grid or TreeView without removing them from the original TreeView. Making a copy of the original TreeViewItem however also includes its parent (all relevant items will have a TreeViewItem as parent).
    TreeViewItem tmp = tvItem;
    (tmp.Parent as TreeViewItem).Remove(tmp); -> This line will remove the tvItem from the TreeView.

    Does anybody know a way to do this?

  2. #2
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815

    Re: Make a copy of a treeviewitem without parent

    I'm not sure if I fully understand your problem... But "adding an item to another TreeView without removing it from the original" boils down to first creating a copy of the existing item, and then insert it into the other treeview. So, I wonder if you are already doing this? Or - is your question all about how to create a clone of an item, in the first place?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured