DevExpress-TreeList 样式

#region TreeList设置

// 禁用排序
foreach (TreeListColumn col in treeList1.Columns)
{
    col.OptionsColumn.AllowSort = false;
}

// 禁用指示器
treeList1.OptionsView.ShowIndicator = false;

// 禁用表头右键
treeList1.OptionsMenu.EnableColumnMenu = false;

// 禁止编辑
colName.OptionsColumn.AllowEdit = false;

// 绑定key
treeList1.KeyFieldName = nameof(VMDept.Sysid);
treeList1.ParentFieldName = nameof(VMDept.ParentId);

// 选中整行
treeList1.OptionsSelection.EnableAppearanceFocusedCell = false;
treeList1.OptionsSelection.EnableAppearanceFocusedRow = true;
//在获得焦点的Cell上,是否显示焦点框架。默认为True
treeList1.OptionsView.FocusRectStyle = DrawFocusRectStyle.None;

// 启用搜索框
treeList1.OptionsFind.AlwaysVisible = true;
treeList1.OptionsFind.AllowFindPanel = true;
treeList1.OptionsFind.ShowSearchNavButtons = true;
// 显示关闭按钮
treeList1.OptionsFind.ShowCloseButton = false;
// 显示查找按钮
treeList1.OptionsFind.ShowFindButton = false;
treeList1.OptionsFind.FindNullPrompt = "请输入部门名称";

//TreeList 边框
treeList1.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
//默认显示下拉三角形样式,设置TreeList的两个皮肤属性即可变成连接虚线
treeList1.LookAndFeel.UseDefaultLookAndFeel = false;
treeList1.LookAndFeel.UseWindowsXPTheme = true;

treeList1.OptionsView.ShowHorzLines = true; //是否显示水平线。默认为True;
treeList1.OptionsView.ShowVertLines = true; //是否显示垂直线。默认为True;
treeList1.OptionsView.ShowColumns = false; //是否显示列标题。默认为True;




#region 右键汉化
treeList1.PopupMenuShowing += (sender, e) =>
{
    foreach (DevExpress.Utils.Menu.DXMenuItem item in e.Menu.Items)
    {
        if (item.Caption == "Full Expand")
        {
            item.Caption = "全部展开";
        }

        if (item.Caption == "Expand")
        {
            item.Caption = "展开";
        }

        if (item.Caption == "Collapse")
        {
            item.Caption = "折叠";
        }

        if (item.Caption == "Full Collapse")
        {
            item.Caption = "全部折叠";
        }
    }
};
#endregion

#endregion

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

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值