void DisposePValue() { foreach (var v in spPValue.Children) { PropertyGridEventBindCtrl pgec = v as PropertyGridEventBindCtrl; pgec.LostFocus -= pgec_LostFocus; pgec.Dispose(); } spPValue.Children.Clear(); }
void AddPropertyToStackPanel(List <EventInfoAttribute> item) { double height = ConstantCollection.HEIGHT; string controlName = string.Format("{0}", this._ReadUIElement.GetValue(Canvas.NameProperty)); if (controlName.Length > 4 && controlName.Substring(0, 4).Equals("Form")) { controlName = "Form"; } var _xml = IDesignFramework.GetCurrentXmlTemplate(); foreach (var v in item) { PropertyGridEventBindCtrl pgec = new PropertyGridEventBindCtrl(); pgec.Name = string.Format("pgec_{0}", v.Name); pgec.ShowName = v.Description; pgec.Height = height; pgec.AssemblyQualifiedName = v.AssemblyQualifiedName; pgec.MethodName = v.Name; pgec.ParentControl = _ReadUIElement; pgec.IDesignFramework = this.IDesignFramework; pgec.LostFocus += new RoutedEventHandler(pgec_LostFocus); pgec.AttributeInfo = v; pgec.CurrentSelectedControlName = this.CurrentSelectedControlName; var eli = _xml.EventLinkItem.Where( p => p.ControlName.Equals(controlName) && p.EventName.Equals(pgec.MethodName)).GetFirst <EventLinkInfo>(); if (null != eli && 0 < eli.Item.Count) { var _eventItem = from p in eli.Item select p.Description.IsNullOrEmpty() ? p.EventName : p.Description; string _value = string.Join(",", _eventItem); string _messageTip = string.Format("[{0}]调用[{1}]方法;{2}", pgec.MethodName, _eventItem.Count(), _value); pgec.LoadInitValue(_value, _messageTip); } spPValue.Children.Add(pgec); } }
void AddFunctionToStackPanel(string controlName, List <FunctionInfo> item, XmlTemplate _xml) { if (null == item || 0 == item.Count) { return; } double height = ConstantCollection.HEIGHT; foreach (var v in item) { PropertyGridEventBindCtrl pgec = new PropertyGridEventBindCtrl(); pgec.Name = string.Format("pgec_Fun_{0}", v.Name); pgec.ShowName = v.Description; pgec.Height = height; pgec.MethodName = v.Name; pgec.ParentControl = _ReadUIElement; pgec.IDesignFramework = this.IDesignFramework; pgec.LostFocus += pgec_LostFocus; pgec.AttributeInfo = new EventInfoAttribute(v.Name, null, v.Description, v.EventDesigner); pgec.CurrentSelectedControlName = this.CurrentSelectedControlName; var eli = _xml.EventLinkItem.Where( p => p.ControlName.Equals(controlName) && p.EventName.Equals(pgec.MethodName)).GetFirst <EventLinkInfo>(); if (null != eli && 0 < eli.Item.Count) { var _eventItem = from p in eli.Item select p.Description.IsNullOrEmpty() ? p.EventName : p.Description; string _value = string.Join(",", _eventItem); string _messageTip = string.Format("[{0}]调用[{1}]方法;{2}", pgec.MethodName, _eventItem.Count(), _value); pgec.LoadInitValue(_value, _messageTip); } spPValue.Children.Add(pgec); } }