public void SelectNode(SharpTreeNode obj) { if (obj != null) { if (!obj.AncestorsAndSelf().Any(node => node.IsHidden)) { // Set both the selection and focus to ensure that keyboard navigation works as expected. treeView.FocusNode(obj); treeView.SelectedItem = obj; } else { MessageBox.Show("Navigation failed because the target is hidden or a compiler-generated class.\n" + "Please disable all filters that might hide the item (i.e. activate " + "\"View > Show internal types and members\") and try again.", "ILSpy", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } }
internal void SelectNode(SharpTreeNode obj) { if (obj != null) { if (!obj.AncestorsAndSelf().Any(node => node.IsHidden)) { // Set both the selection and focus to ensure that keyboard navigation works as expected. treeView.FocusNode(obj); treeView.SelectedItem = obj; } else { MessageBox.Show("导航失败,因为目标类型是隐藏或编译器生成的类型。\n" + "请引用可能会隐藏它们的过滤器(如启用 “视图-显示内部成员和类型”)然后重试。", "ILSpy", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } }