private void CreateUIControls(object sender, EventArgs e) { IFindControlService findControlSrv = this.GetService <IFindControlService>(); Control control = null; _funtionList = UIEntity.CreateViewEntity(null); DependencyObjectView dv = CreateDataSource(); _dataSource = dv.DependencyObject; _dataSource.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(dataSource_PropertyChanged); if (findControlSrv.TryGet("desingerTabControl1", out control)) { TabControl tabControl = control as TabControl; tabControl.SuspendLayout(); CreateTableLayout(); CreateUIView(); tabControl.TabPages[0].Controls.Add(_table); tabControl.ResumeLayout(false); } }
void _dgGrid1_form_Click(object sender, EventArgs e) { //执行逻辑 _isLableClick = true; try { int focusHander = _dgGrid1.InnerGridView.FocusedRowHandle; string columnName = _dgGrid1.InnerGridView.FocusedColumn.FieldName; BindingSource bs = _dgGrid1.DataSource as BindingSource; DependencyObjectCollection entityDs = ((DependencyObjectCollectionView <DependencyObjectView>)bs.List).DependencyObjectCollection; DependencyObjectView selectValue = _dgGrid1.SelectedValue as DependencyObjectView; if (focusHander >= 0 && focusHander < entityDs.Count && selectValue != null) { DependencyObject selectObj = selectValue.DependencyObject; for (int i = focusHander + 1; i < _dgGrid1.InnerGridView.RowCount; i++) { if (columnName == "PLAN_START_DATE") { entityDs[i]["PLAN_START_DATE"] = selectObj["PLAN_START_DATE"]; } if (columnName == "PLAN_COMPLETE_DATE") { entityDs[i]["PLAN_COMPLETE_DATE"] = selectObj["PLAN_COMPLETE_DATE"]; } if (columnName == "PLAN_ISSUE_DATE") { entityDs[i]["PLAN_ISSUE_DATE"] = selectObj["PLAN_ISSUE_DATE"]; } } } } catch (Exception e1) { }; Form form = (Form)(((Label)sender).Parent); form.Close(); _isLableClick = false; }
/// <summary> /// 创建界面绑定view /// </summary> /// <returns></returns> private DependencyObjectView CreateDataSource() { DependencyObjectType type = new DependencyObjectType("Type"); type.RegisterSimpleProperty("Function", typeof(string)); foreach (ParaEntity para in CurrentFunction.ParaList) { type.RegisterSimpleProperty(para.ConditionName, typeof(string)); type.RegisterSimpleProperty(para.Name, para.ParaType); if (para.ParaTypeFlag == ParaTypeEnum.SelectControl) { type.RegisterSimpleProperty(para.Name.Replace("_ID", "_NAME"), typeof(string)); type.RegisterSimpleProperty(para.Name.Replace("_ID", "_CODE"), typeof(string)); } } DependencyObject obj = new DependencyObject(type); DependencyObjectView view = new DependencyObjectView(obj); return(view); }