Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - How do I programmatically find an item in a TreeView?

 
 
Old 08-08-2007   #1 (permalink)
Jeremy Chaney


 
 

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?

My System SpecsSystem Spec
Old 08-08-2007   #2 (permalink)
Patrice


 
 

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 ?

My System SpecsSystem Spec
Old 08-08-2007   #3 (permalink)
Patrice


 
 

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...

My System SpecsSystem Spec
Old 08-16-2007   #4 (permalink)
Mark Moeykens


 
 

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?

My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Could not find this item Vista file management
Could not find this item Vista file management
Find out active graphics device programmatically (registry key) Vista hardware & devices


Vista Forums 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 Ltd

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