using DevExpress.Mvvm.Native;
|
using DevExpress.XtraEditors.Repository;
|
|
namespace Yw.WinFrmUI
|
{
|
public partial class ApplyHydroGradingCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public ApplyHydroGradingCtrl()
|
{
|
InitializeComponent();
|
this.gridView1.SetNormalEditView();
|
this.colCatalogName.OptionsColumn.AllowEdit = false;
|
this.gridView1.CustomRowCellEdit += GridView1_CustomRowCellEdit;
|
}
|
|
private BindingList<HydroGradingApplyViewModel> _allBindingList = null;
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
public void SetBindingData(List<HydroGradingApplyViewModel> allApplyList)
|
{
|
_allBindingList = new BindingList<HydroGradingApplyViewModel>();
|
allApplyList?.ForEach(x =>
|
{
|
_allBindingList.Add(x);
|
});
|
this.hydroGradingApplyViewModelBindingSource.DataSource = _allBindingList;
|
this.hydroGradingApplyViewModelBindingSource.ResetBindings(false);
|
}
|
|
/// <summary>
|
/// 获取应用列表
|
/// </summary>
|
public List<HydroGradingApplyViewModel> GetApplyList()
|
{
|
return _allBindingList?.ToList();
|
}
|
|
//自定义
|
private void GridView1_CustomRowCellEdit(object sender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs e)
|
{
|
var row = this.gridView1.GetRow(e.RowHandle) as HydroGradingApplyViewModel;
|
if (row == null)
|
{
|
return;
|
}
|
if (e.Column == this.colPropName)
|
{
|
var repositoryItem = new RepositoryItemImageComboBox();
|
var dict = HydroGradingPropHelper.GetDict(row.Catalog);
|
dict?.ForEach(x => repositoryItem.Items.Add(x.Value, x.Key, -1));
|
e.RepositoryItem = repositoryItem;
|
}
|
}
|
|
|
}
|
}
|