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.colParter.OptionsColumn.AllowEdit = false;
this.colPropName.OptionsColumn.AllowEdit = false;
this.colUnitName.OptionsColumn.AllowEdit = false;
this.colFlags.OptionsColumn.AllowEdit = false;
this.colDescription.OptionsColumn.AllowEdit = false;
}
///
/// 查看水力事件
///
public event Action HydroViewEvent;
private BindingList _allBindingList = null;//所有绑定列表
///
/// 绑定数据
///
public void SetBindingData(List allList)
{
_allBindingList = new BindingList();
allList?.OrderBy(x => x.SortCode).ForEach(x => _allBindingList.Add(x));
this.hydroMonitorValueViewModelBindingSource.DataSource = _allBindingList;
this.hydroMonitorValueViewModelBindingSource.ResetBindings(false);
}
///
/// 设置视图面板
///
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.Parter);
}
}
}