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

Select hidden treeviewitem in databound treeview

Closed Thread
 
Thread Tools Display Modes
Old 01-31-2006   #1 (permalink)
RyanLeeSchneider
Guest


 

Select hidden treeviewitem in databound treeview


I'm having an issue selecting a databound treeview item in a treeview.

If the treeview has not already been expanded, then the treeviewitems don't
exist, so the code:

TreeViewItem tvi =
(TreeViewItem)(header.ItemContainerGenerator.ContainerFromItem(databoundobject));

returns null.

If I do:

header.IsExpanded = true;

before the call, the UI isn't updated (and the items bound) until after my
method returns, so I still get null (but the treeview is expended after my
method returns).

So, I tried using a WorkItem to expand on another thread:

if(header.IsExpanded == false)
{
header.IsExpanded = true;
//we have to queue a workitem since we have to wait for
the header to expand

System.Threading.ThreadPool.QueueUserWorkItem(ExpandedToSelectProcessWorkItemCallback, databoundobject);
}

However, then my callback throws a InvalidOperation exception because I'm
accessing the treeview on another thread.

So, I dug around and found people talking about the UIContext in this NG,
but I can't find any mention of it in the Dec CTP.

So, my question is:

-What's the best way to expand the treeview before searching it? (Please
don't say animations, please don't say animations.. )
-Bonus Question: what's the equivalent of UIContext in the Dec CTP?

Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Databound animation Joao Paulo Duque Vieira Avalon 4 04-13-2008 11:28 AM
TreeView, TreeViewItem knallkopf66 Avalon 1 08-16-2007 08:24 PM
How to get the Parent of a TreeViewItem in a treeview when using HierchicalDataTemplate ? Pon Avalon 1 04-05-2007 03:16 AM
Databound treeview and selectedItem cast to Treeviewitem cheesetarmac Avalon 2 11-14-2006 03:43 AM
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