using DevExpress.XtraEditors.Controls;
|
using HStation.Vmo;
|
using System.Data;
|
|
namespace HStation.WinFrmUI
|
{
|
public partial class PhartDiagramRelationListCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public PhartDiagramRelationListCtrl()
|
{
|
InitializeComponent();
|
}
|
|
/// <summary>
|
/// 边框可见性
|
/// </summary>
|
public bool BorderVisible
|
{
|
get
|
{
|
return this.imageListBoxControl1.BorderStyle != BorderStyles.NoBorder;
|
}
|
set
|
{
|
this.imageListBoxControl1.BorderStyle = value ? BorderStyles.Default : BorderStyles.NoBorder;
|
}
|
}
|
|
/// <summary>
|
/// 选择改变事件
|
/// </summary>
|
public event Action<PhartDiagramRelationVmo> SelectedChangedEvent;
|
|
private List<PhartDiagramRelationListItemViewModel> _allBindingList = null;
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
public void SetBindingData(List<PhartDiagramRelationVmo> allList)
|
{
|
_allBindingList = new List<PhartDiagramRelationListItemViewModel>();
|
allList?.OrderBy(x => x.SortCode).ToList()
|
.ForEach(x => _allBindingList.Add(new PhartDiagramRelationListItemViewModel(x)));
|
this.phartDiagramRelationListItemViewModelBindingSource.DataSource = _allBindingList;
|
this.phartDiagramRelationListItemViewModelBindingSource.ResetBindings(false);
|
}
|
|
//选择改变
|
private void imageListBoxControl1_SelectedValueChanged(object sender, EventArgs e)
|
{
|
if (_allBindingList == null)
|
{
|
return;
|
}
|
var item = this.imageListBoxControl1.SelectedItem;
|
var vm = item as PhartDiagramRelationListItemViewModel;
|
if (vm == null)
|
{
|
return;
|
}
|
this.SelectedChangedEvent?.Invoke(vm.Vmo);
|
}
|
|
private void toolTipController1_GetActiveObjectInfo(object sender, DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventArgs e)
|
{
|
if (e.SelectedControl == this.imageListBoxControl1)
|
{
|
//e.Info = new ToolTipControlInfo(item, tooltipText);
|
}
|
}
|
|
}
|
}
|