internal void UpdateWithSyntaxRoot(SyntaxNodeOrToken root, int position) { clear(); TreeViewItem rootItem = null; rootItem = new TreeViewItem(); TreeContainer.Items.Add(rootItem); rootItem.DataContext = root; generateSyntaxTreeView(root, rootItem); selectCorrespondingTreeViewItem(position); }
private void generateSyntaxTreeView(SyntaxNodeOrToken node, TreeViewItem item) { item.Header = node.Kind + " [" + node.StartPosition + ".." + node.End + ")"; if (node.IsToken) { item.Foreground = Brushes.Green; } else { item.Foreground = Brushes.Blue; } foreach (var child in node.Children) { var childItem = new TreeViewItem(); childItem.DataContext = child; item.Items.Add(childItem); generateSyntaxTreeView(child, childItem); } }