itemcontainergenerator

wpf manually generate TreeViewItem container

I am creating a TreeView at runtime. It has several nodes(TreeViewItem), each one having a name. Initially it is collapsed. A separate comboBox displays Names of all TreeViewItem. I have to highlight a TreeViewItem based on the Name selected. I am using a recursive function and gets the TreeViewItem container like this: if (parent.ItemC...

WPF Listview - Select items outside 'field of view'

Hi there, I'm using a ListView to show Items in a List. The user can select the items himself, or use some 'preselect keys' to select items with specified attributes. To check the items I use something like that: for(int i;i<MyListView.Items.Count;++i) { if( /*... Check if the items should be selected ...*/ ) (MyListView.It...

Getting the TreeViewItem on newly created items

There has to be a better way then the following for getting "childItem" TaskItem task = (sender as Canvas).DataContext as TaskItem; TaskItem child = Tasks.CreateTask("New task", task); TreeViewItem item = treeView.ItemContainerGenerator.ContainerFromItem(task) as TreeViewItem; item.UpdateLayout(); TreeVi...