private void InitExistBindingPair(ComboBox cb, PropertyInfo p, BindingPair[] pairs) { foreach (BindingPair pir in pairs) { if (pir.PropertyInfo.Equals(p)) { if (pir.PropertyValue is PropertyValueByValue) { object txt = (pir.PropertyValue as PropertyValueByValue).Value; if (txt != null) { cb.Text = txt.ToString(); } } else if (pir.PropertyValue is PropertyValueByVar) { cb.Text = (pir.PropertyValue as PropertyValueByVar).VarValue; } else if (pir.PropertyValue is PropertyValueByRef) { PropertyValueByRef refv = pir.PropertyValue as PropertyValueByRef; BindingScriptObject obj = new BindingScriptObject(refv.RefAction, refv.RefBindingAttribute, refv.RefPropertyInfo, p); cb.Items.Add(obj); cb.SelectedIndex = cb.Items.Count - 1; } break; } } }
public BindingPair ToBindingPair() { PropertyValueByRef refv = new PropertyValueByRef(); refv.ArgType = enumArgType.Ref; refv.RefAction = RefAction; refv.RefPropertyInfo = RefPropertyInfo; refv.RefBindingAttribute = RefBindingAtt; return(new BindingPair(TargetPropertyInfo, refv)); }