duheng
2024-11-21 c653f2f6f2de553395b706de3a62fec5e4a6fbf7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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.colRelation.OptionsColumn.AllowEdit = false;
            this.colPropName.OptionsColumn.AllowEdit = false;
            this.colDescription.OptionsColumn.AllowEdit = false;
        }
 
        /// <summary>
        /// 查看水力事件
        /// </summary>
        public event Action<string> HydroViewEvent;
 
        private BindingList<HydroMonitorValueViewModel> _allBindingList = null;//所有绑定列表
 
        /// <summary>
        /// 绑定数据
        /// </summary>
        public void SetBindingData(List<HydroMonitorValueViewModel> allValueList)
        {
            _allBindingList = new BindingList<HydroMonitorValueViewModel>();
            allValueList?.OrderBy(x => x.SortCode).ForEach(x => _allBindingList.Add(x));
            this.hydroMonitorValueViewModelBindingSource.DataSource = _allBindingList;
            this.hydroMonitorValueViewModelBindingSource.ResetBindings(false);
        }
 
        //行点击
        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);
        }
    }
}