Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

How do I programmatically find an item in a TreeView?

Closed Thread
 
Thread Tools Display Modes
Old 08-08-2007   #1 (permalink)
Jeremy Chaney
Guest


 

How do I programmatically find an item in a TreeView?

I've seen lots of people talking about
"ItemContainerGenerator.ContainerFromItem", but I don't have an item to pass
it, I only have the text that the item displays. Do I just iterate all items
in the tree and compare each nodes text?
Old 08-08-2007   #2 (permalink)
Patrice
Guest


 

Re: How do I programmatically find an item in a TreeView?

On 8 août, 18:54, Jeremy Chaney
<JeremyCha...@discussions.microsoft.com> wrote:
> I've seen lots of people talking about
> "ItemContainerGenerator.ContainerFromItem", but I don't have an item to pass
> it, I only have the text that the item displays. Do I just iterate all items
> in the tree and compare each nodes text?


uh... in this case, what else could u (recursively) do ?

Old 08-08-2007   #3 (permalink)
Patrice
Guest


 

Re: How do I programmatically find an item in a TreeView?

On 8 août, 18:54, Jeremy Chaney
<JeremyCha...@discussions.microsoft.com> wrote:
> I've seen lots of people talking about
> "ItemContainerGenerator.ContainerFromItem", but I don't have an item to pass
> it, I only have the text that the item displays. Do I just iterate all items
> in the tree and compare each nodes text?


Anyhow, ItemContainerGenerator.ContainerFromItem can work if your
items type is string...

Old 08-16-2007   #4 (permalink)
Mark Moeykens
Guest


 

RE: How do I programmatically find an item in a TreeView?

Hi Jeremy,

Are you trying to find a TreeViewItem in a TreeView using the text shown in
the TreeViewItem?

I did something similar by writing a recursive method that cycles through
all the TreeViewItems and comparing the TreeViewItem.Header with my search
text. If you need a code sample let me know.





"Jeremy Chaney" wrote:

> I've seen lots of people talking about
> "ItemContainerGenerator.ContainerFromItem", but I don't have an item to pass
> it, I only have the text that the item displays. Do I just iterate all items
> in the tree and compare each nodes text?

Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Invoke-Item cannot find paths with special characters jaraco PowerShell 0 04-27-2008 07:28 PM
Could not find this item Tim Vista file management 10 10-13-2007 06:24 PM
Vista Problem - "Could not find this item" error on viewable folde Dipak Vista General 1 07-22-2007 11:57 AM
TreeView (Item) EnsureVisible Micha Avalon 1 04-13-2007 04:45 PM
Drag and Drop Treeview Items between 2 Treeview ProjectGKR Avalon 3 03-14-2006 07:29 AM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50