public void CollectPropertyLinks(Dictionary <IPropertyValueLinkHolder, Dictionary <IPropertyValueLink, CodeExpression> > links) { string[] names = _links.GetLinkablePropertyNames(); Dictionary <IPropertyValueLink, CodeExpression> kv = new Dictionary <IPropertyValueLink, CodeExpression>(); for (int k = 0; k < names.Length; k++) { IPropertyValueLink pvk = GetPropertyLink(names[k]); if (pvk != null && pvk.IsValueLinkSet()) { //TreeViewX {this}.GetNodeTemplate(int level) to set link to names[k] CodeMethodInvokeExpression mie = new CodeMethodInvokeExpression(); mie.Method.MethodName = "GetNodeTemplateBase"; mie.Parameters.Add(new CodePrimitiveExpression(this.Level)); mie.UserData.Add("name", names[k]); kv.Add(pvk, mie); } } if (kv.Count > 0) { links.Add(this, kv); } if (Nodes.Count > 0) { for (int i = 0; i < Nodes.Count; i++) { TreeNodeXTemplate tt = Nodes[i] as TreeNodeXTemplate; if (tt != null) { tt.CollectPropertyLinks(links); break; } } } }
public TreeNodeX(TreeNodeXTemplate template, FieldList fields) { _template = template; _fields = fields; IsLoadedByDataBinding = true; init(); }
public TreeNodeXTemplate CloneTemplate() { TreeNodeXTemplate tt = new TreeNodeXTemplate(); tt.ForeColor = this.ForeColor; tt.BackColor = this.BackColor; tt.NodeFont = this.NodeFont; tt._owner = _owner; tt._links = _links; return(tt); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { TreeNodeXTemplate tt = context.Instance as TreeNodeXTemplate; if (tt != null) { CommandList list = new CommandList(edSvc); if (tt.ChildLoadStyle == EnumChildLoad.Flat) { list.SelectedIndex = 1; } else if (tt.ChildLoadStyle == EnumChildLoad.None) { list.SelectedIndex = 0; } else if (tt.ChildLoadStyle == EnumChildLoad.Recursion) { list.SelectedIndex = 2; } edSvc.DropDownControl(list); if (list.MadeSelection) { switch (list.Selection) { case 0: tt.ChildLoadStyle = EnumChildLoad.None; break; case 1: tt.ChildLoadStyle = EnumChildLoad.Flat; break; case 2: tt.ChildLoadStyle = EnumChildLoad.Recursion; break; } tt.NotifyDesignChange(context.PropertyDescriptor.Name); } } } } return(value); }