public void CommonItemActivation(object sender, EventArgs eventArgs) { var o = Tree.SelectedObject; if (o == null) { return; } if (UserSettings.DoubleClickToExpand) { if (Tree.CanExpand(o) && !Tree.IsExpanded(o)) { Tree.Expand(o); return; } if (Tree.IsExpanded(o)) { Tree.Collapse(o); return; } } var cmd = new ExecuteCommandActivate(_activator, o); if (!cmd.IsImpossible) { cmd.Execute(); } }
public static void ExpandToObject(this TreeListView tlv, object obj) { object parent = tlv.GetParent(obj); if (parent != null && !tlv.IsExpanded(parent)) { ExpandToObject(tlv, parent); tlv.Expand(parent); } }