Пример #1
0
 /// <summary>
 /// 更新属性
 /// </summary>
 /// <param name="e"></param>
 internal void UpdateProperty(ControlModifyPropertyEventArgs e)
 {
     if (null == item || 0 == item.Count)
     {
         return;
     }
     //-->更新属性操作
     foreach (var v in item)
     {
         if (null == v || v.Name.IsNullOrEmpty())
         {
             continue;
         }
         if (e.DictProperty.ContainsKey(v.Name))
         {
             object obj = spPValue.FindName("pgec_" + v.Name);
             PropertyGridEvaluationCtrl pgec = obj as PropertyGridEvaluationCtrl;
             if (null == pgec)
             {
                 continue;
             }
             pgec.EvaluationValue = e.DictProperty[v.Name];
         }
     }
 }
Пример #2
0
        void AddPropertyToStackPanel(List <PropertyInfoAttribute> item)
        {
            double height = ConstantCollection.HEIGHT;

            spPValue.Children.Clear();
            foreach (var v in item)
            {
                if (null == v)
                {
                    continue;
                }
                var pgec = new PropertyGridEvaluationCtrl();
                pgec.Name                       = string.Format("pgec_{0}", v.Name);
                pgec.Height                     = height;
                pgec.ShowName                   = v.Description;
                pgec.DefaultValue               = v.DefaultValue;
                pgec.AssemblyQualifiedName      = v.AssemblyQualifiedName;
                pgec.DataType                   = v.DataType;
                pgec.MethodName                 = v.Name;
                pgec.PropertyName               = v.Name;
                pgec.ParentControl              = _ReadUIElement;
                pgec.IDesignFramework           = this.IDesignFramework;
                pgec.LostFocus                 += pgec_LostFocus;
                pgec.ContentChange             += pgec_ContentChange;
                pgec.CurrentSelectedControlName = this.CurrentSelectedControlName;
                try
                {
                    string dv = string.Format("{0}", v.DefaultValue);
                    if (!dv.IsNullOrEmpty())
                    {
                        pgec.EvaluationContent = new XElement(v.Name, dv);
                    }
                }
                catch { }
                spPValue.Children.Add(pgec);
            }
        }