lixiaojun
2024-12-23 b9c79f595e5ad4684d731f968bf120ff8c52dbd8
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using DevExpress.Mvvm.Native;
using DevExpress.Xpo.Helpers;
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.colUnitName.OptionsColumn.AllowEdit = false;
            this.colFlags.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> allList)
        {
            _allBindingList = new BindingList<HydroMonitorValueViewModel>();
            allList?.OrderBy(x => x.SortCode).ForEach(x => _allBindingList.Add(x));
            this.hydroMonitorValueViewModelBindingSource.DataSource = _allBindingList;
            this.hydroMonitorValueViewModelBindingSource.ResetBindings(false);
        }
 
        /// <summary>
        /// 设置视图面板
        /// </summary>
        public void SetViewBoard()
        {
            this.colPropValue.OptionsColumn.AllowEdit = false;
            this.colPropValue.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);
        }
 
 
 
    }
}