private void TreeViewBeforeExpand(object sender, TreeViewCancelEventArgs e) { e.Node.Nodes.Clear(); var doc = e.Node.Tag as TextDocument; if (doc != null) { var sciDoc = doc.GetSciDocument(); using (var sci = new ScintillaControl()) { sci.AttachDocument(sciDoc); sci.GetAllBookmarks().ForEach(l => AddBookmark(sci, e.Node, l)); } } }