Beispiel #1
0
        private void ExpandSourceTreeButOnlyFor(IList <TextElement> list)
        {
            try
            {
                CodeSourceTreeIsCollapsing = true;

                List <TreeViewItem> expandedItems = new List <TreeViewItem>();

                foreach (TextElement te in list)
                {
                    TreeViewItem tvi = Parser.TextElementToTreeViewItem(te);

                    while (tvi != null)
                    {
                        expandedItems.Add(tvi);
                        tvi.IsExpanded = true;
                        tvi            = tvi.Parent as TreeViewItem;
                    }
                }

                foreach (TreeViewItem tvi in CodeSourceTree.Items)
                {
                    CollapseAllChildrenExcept(tvi, expandedItems);
                }
            }
            finally
            {
                CodeSourceTreeIsCollapsing = false;
            }
        }