namespace HStation.WinFrmUI { public partial class XhsProjectSimulationValveMatchingListCtrl : DevExpress.XtraEditors.XtraUserControl { public XhsProjectSimulationValveMatchingListCtrl() { InitializeComponent(); this.gridView1.SetNormalView(30); this.gridView1.OptionsView.ShowDetailButtons = true; this.gridView1.OptionsView.ShowGroupPanel = false; } private List _allBindingList = new List(); /// /// 点击事件 /// public event Action RowClickEvent; public void SetBindingData(List valveMatchingViewModels) { if (valveMatchingViewModels != null) { foreach (var item in valveMatchingViewModels) { _allBindingList.Add(new XhsProjectSimulationValveMatchingViewModel(item)); } this.valveFormViewModelBindingSource.DataSource = _allBindingList; } } public List SetMatching(List inputs, List alllist) { if (inputs == null) return null; foreach (var item in inputs) { AssetsMatchingHelper.MatchingValve(item, alllist); } _allBindingList.Clear(); foreach (var item in inputs) { _allBindingList.Add(new XhsProjectSimulationValveMatchingViewModel(item)); } this.valveFormViewModelBindingSource.ResetBindings(false); return inputs; } //行点击事件 private void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { var row = this.gridView1.GetCurrentViewModel(_allBindingList); if (row == null) { return; } this.RowClickEvent?.Invoke(row.Code); } } }