![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
| |
| | #1 (permalink) |
| | 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? |
My System Specs![]() |
| Thread Tools | |
| |