/// <summary> /// 初始化 /// </summary> public void Init() { if (source != null) { return; } source = this.DataContext as IParatItem; if (source == null) { return; } if (IsAsInput) { IParaItemForEnum forenum = IParaItemForEnum.GetInstance(); IReflexui iref = forenum.GetControlType(source.PIEnum); if (iref != null) { iref.Bind(source, "Value"); this.content.Child = iref as Control; } } this.propertyCombox.ItemsSource = ScriptLayout.IPropertys; this.propertyCombox.DisplayMemberPath = "Name"; if ((source as ParatItem) != null && (source as ParatItem).LinkIProperty != null) { isopen.IsChecked = true; } else { isopen.IsChecked = false; } }
/// <summary> /// 添加一个类型和控件的映射 /// </summary> /// <param name="penum"></param> /// <param name="iref"></param> public void SetType(ParaItemEnum penum, IReflexui iref) { if (iref as Control == null) { throw new Exception("添加的控件类型异常,请继承Cntrol, 并且实现IReflexui方法"); } if (this.typeDictionary.ContainsKey(penum)) { this.typeDictionary[penum] = null; this.typeDictionary[penum] = iref; } else { this.typeDictionary.Add(penum, iref); } }