winform dev 网格树形下拉 控件封装

Dev 官网连接
TreeList
PopupContainerControl
PopupContainerEdit

效果图:
在这里插入图片描述

添加一个组件 开始自定义控件
在这里插入图片描述

文件结构
在这里插入图片描述

Entity Code

using System;

namespace Test
{
   
   
    public class DataDto
    {
   
   
        public Guid Id {
   
    get; set; }
        public Guid ParentId {
   
    get; set; }
        public string Name {
   
    get; set; }
        public string Value {
   
    get; set; }
    }
}

Event Code:

using System;
using System.Collections.Generic;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraEditors.Repository;

namespace Test
{
   
   
    public partial class ComponentName : PopupContainerControl
    {
   
   
    	// 控制清除 确定 取消 三个按钮的显示
        public bool showCancelButton = true;
        public bool showOKButton = false;
        public bool showClearButton = false;

        private bool firstLoad = true;

        private List<DataDto> ListData {
   
    get; set; }
        public DataDto Current {
   
    get; set; }

        public event Action<DataDto> ChangeValue;

        protected PopupContainerEdit edit;

        private RepositoryItemPopupContainerEdit PopupControl {
   
    get; set; }

        public ComponentName()
        {
   
   
            this.InitializeComponent();

            this.btnCancel.Visible = this.showCancelButton;
            this.btnClear.Visible = this.showClearButton;
            this.btnOK.Visible = this.showOKButton;

            this.ListData = new List<DataDto>();

            this.PopupControl = new RepositoryItemPopupContainerEdit
            {
   
   
                TextEditStyle = TextEditStyles.Standard,
                PopupControl = this
            };
            this.PopupControl.Popup += PopupControl_Popup;
            this.PopupContainerProperties.ShowPopupCloseButton = false;

            this.PopupContainerProperties.PopupWidthMode = PopupWidthMode.UseEditorWidth;

            this.PopupControl.BeforePopup += PopupControl_BeforePopup;
            this.PopupControl.Closed +
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值