public void RefreshPropList(JWCControl ctrl) { _PropPanel.Children.Clear(); Type tp = ctrl.GetType(); bool cl = false; foreach (PropertyInfo pi in tp.GetProperties()) { if (Attribute.IsDefined(pi, typeof(PropDiscribeAttribute))) { PropDiscribeAttribute pat = pi.GetCustomAttributes(typeof(PropDiscribeAttribute), true)[0] as PropDiscribeAttribute; APropItem itm = PropItemFactory.GetPropItem(pat, ctrl, pi); var showitm = itm.GetControl(); Grid grd = new Grid(); grd.Background = cl ? color1 : color2; cl = !cl; grd.Children.Add(showitm); _PropPanel.Children.Add(grd); itm.TimeToShowHelpString += itm_TimeToShowHelpString; if (pi.Name == "Name") { itm.OnPropValueChanged += itm_OnPropValueChanged; } else if (pi.Name == "Size") { this.SetSizeFun = itm.SetPropShowValue; } else if (pi.Name == "Margin") { this.SetMarginFun = itm.SetPropShowValue; } } } }
public void RefreshComPropList(IPropGWAble com) { _PropPanel.Children.Clear(); Type tp = com.GetType(); bool cl = false; foreach (PropertyInfo pi in tp.GetProperties()) { if (Attribute.IsDefined(pi, typeof(PropDiscribeAttribute))) { PropDiscribeAttribute pat = pi.GetCustomAttributes(typeof(PropDiscribeAttribute), true)[0] as PropDiscribeAttribute; APropItem itm = PropItemFactory.GetPropItem(pat, com, pi); var showitm = itm.GetControl(); Grid grd = new Grid(); grd.Background = cl ? color1 : color2; cl = !cl; grd.Children.Add(showitm); _PropPanel.Children.Add(grd); itm.TimeToShowHelpString += itm_TimeToShowHelpString; } } if (_PropPanel.Children.Count == 0) { _TxtHelp.Text = "该控件没有可以设置的属性。"; } }
void itm_OnPropValueChanged(APropItem sender, IPropGWAble arg1, PropertyInfo arg2, object arg3) { JWCControl jc = arg1 as JWCControl; if (jc == null) { return; } if (jc.Focused) { RefreshCurrName(jc); } }