Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

remove subitems from silverlight 4 treeview

Posted on 2010-08-28
4
Medium Priority
?
734 Views
Last Modified: 2013-12-17
Anyone that can provide me with a small example on how to remove SUBITEMS from silverlight 4 treeview? Silverlight 4 / VS 2010 / C#
0
Comment
Question by:deeMvee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 

Author Comment

by:deeMvee
ID: 33552627
"The above code removes root items from the TreeView, not the subitems. To remove sub items, first we need to find the selected item and then we need to call TreeViewItem.Items.RemoveAt method."

How do you find and delete the subitem?
0
 

Accepted Solution

by:
deeMvee earned 0 total points
ID: 33616434
Strange that this is difficult...

Anyway, found a solution:
Just set the visibility for the item to visibility.collapsed and delete it from datasource.
Next time you populate the three it's gone... :) ease and just one line of code...
0
 

Author Comment

by:deeMvee
ID: 33788243
                       TreeViewItem parent = (copyItem).Parent as TreeViewItem;
                        parent.Items.Remove(copyItem); // Cut
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question