private void AddTreeViewItem(ItemCollection items, WorkItem workItem) { bool firstChild = (items.Count == 0); WorkItemTreeViewItem item = new WorkItemTreeViewItem(workItem); items.Add(item); if (firstChild && (item.Parent is WorkItemTreeViewItem)) { (item.Parent as WorkItemTreeViewItem).IsExpanded = true; } }