using DevExpress.Mvvm.Native; using System.Data; namespace Yw.WinFrmUI { public partial class HydroMonitorValueListCtrl : DevExpress.XtraEditors.XtraUserControl { public HydroMonitorValueListCtrl() { InitializeComponent(); this.gridView1.SetNormalEditView(30); this.gridView1.RegistCustomDrawRowIndicator(40); this.colVisualName.OptionsColumn.AllowEdit = false; this.colPropName.OptionsColumn.AllowEdit = false; this.colUnitName.OptionsColumn.AllowEdit = false; this.colDescription.OptionsColumn.AllowEdit = false; } /// /// 查看水力事件 /// public event Action HydroViewEvent; private BindingList _allBindingList = null;//所有绑定列表 /// /// 绑定数据 /// public void SetBindingData(List allMonitorValueList) { _allBindingList = new BindingList(); allMonitorValueList?.OrderBy(x => x.SortCode).ForEach(x => _allBindingList.Add(x)); this.hydroMonitorValueViewModelBindingSource.DataSource = _allBindingList; this.hydroMonitorValueViewModelBindingSource.ResetBindings(false); } /// /// 设置视图面板 /// public void SetViewBoard() { this.colMonitorValue.OptionsColumn.AllowEdit = false; this.colMonitorValue.ImageOptions.SvgImage = null; } //行点击 private void gridView1_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { var row = this.gridView1.GetRow(e.RowHandle) as HydroMonitorValueViewModel; if (row == null) { return; } this.HydroViewEvent?.Invoke(row.Vmo.Relation); } } }