private void FilterEditor_CustomEditorInitializing(object sender, CustomEditorEventArgs e) { if (e.PropertyName == "Brand") { var cmb = new C1ComboBox() { AutoSize = false, Width = 120 }; cmb.ItemsDataSource = Data.GetDataSource(); cmb.ItemsValueMember = "Brand"; cmb.ItemsDisplayMember = "Brand"; e.Control = cmb; } }
public void xapFormControl1_CustomEditor(object sender, CustomEditorEventArgs e) { switch (e.PropName) { case "Val_rstrptlab": CiRptLabItmDO ciDo = this.xapFormControl1.GetFocused <CiRptLabItmDO>("List"); // 如果 选中数据为 null 则 return 邵远 20160708 if (ciDo == null) { return; } switch (ciDo.Sd_restrptlabtp) { case "0": //数值 XRepositoryItemNumEdit be = new XRepositoryItemNumEdit(this.xapFormControl1.GetGridView("List")); //be.OriginalPrecision = 2; e.Editor = be; break; case "1": //字符串 e.Editor = new XRepositoryItemTextEdit(this.xapFormControl1.GetGridView("List")); break; case "2": //下拉 string[] strlist = ciDo.Val_range.Split(','); string str = "STRING:[" + strlist[0] + ":" + strlist[0]; for (int i = 1; i < strlist.Length; i++) { str = str + "," + strlist[i] + ":" + strlist[i]; } str = str + "]"; DropListConfig list = new DropListConfig(str); XDropList ctrl = new XDropList(); ctrl.NullText = ""; ctrl.DataSource = list; ctrl.DisplayMember = "Name"; ctrl.ValueMember = "Code"; e.Editor = ctrl; break; } break; } }