Files
AntdUI/doc/wiki/zh/Control/Tree.md
2025-03-12 17:32:44 +08:00

3.2 KiB
Raw Blame History

首页更新日志配置主题

Tree

Tree 树形控件 👚

多层次的结构列表。

  • 默认属性Items
  • 默认事件SelectChanged

属性

名称 描述 类型 默认值
ForeColor 文字颜色 Color? null
ForeActive 激活字体颜色 Color? null
BackHover 悬停背景颜色 Color? null
BackActive 激活背景颜色 Color? null
Gap 间距 int 8
Radius 圆角 int 6
Round 圆角样式 bool false
IconRatio 图标比例 float 1F
Checkable 节点前添加 Checkbox 复选框 bool false
CheckStrictly Checkable 状态下节点选择完全受控 父子节点选中状态不再关联 bool true
BlockNode 节点占据一行 bool false
Items 数据 TreeItem[] TreeItem[] []
PauseLayout 暂停布局 bool false

事件

名称 描述 返回值 参数
SelectChanged Select 属性值更改时发生 void MouseEventArgs args 点击, TreeItem item 数值, Rectangle rect 项区域
CheckedChanged Checked 属性值更改时发生 void TreeItem item 数值, bool value 选中值
NodeMouseClick 点击项事件 void MouseEventArgs args 点击, TreeItem item 数值, Rectangle rect 项区域
NodeMouseDoubleClick 双击项事件 void MouseEventArgs args 点击, TreeItem item 数值, Rectangle rect 项区域
NodeMouseMove 移动项事件 void TreeItem item 数值, Rectangle rect 项区域, bool hover 悬停值

方法

名称 描述 返回值 参数
ExpandAll 展开全部 void bool value true 展开、false 收起
GetCheckeds 获取所有选中项 List<TreeItem>
Select 选择指定项 bool TreeItem item
USelect 取消全部选择 void
SetCheckeds 全选/全不选 void
Focus 跳转指定项 bool TreeItem item

数据

TreeItem

名称 描述 类型 默认值
ID ID string? null
Name 名称 string? null
Icon 图标 Image? null
IconSvg 图标SVG string? null
Text 文本 string 必填
🌏 LocalizationText 国际化文本 string? null
SubTitle 子标题 string null
🌏 LocalizationSubTitle 国际化子标题 string? null
Fore 字体颜色 Color? null
Back 背景颜色 Color? null
Visible 是否显示 bool true
Enabled 禁用状态 bool true
Expand 展开 bool true
CanExpand 是否可以展开 bool 只读
Checked 选中状态 bool false
CheckState 选中状态 CheckState Unchecked
Sub 子集合 ♾️ TreeItem[] []
Tag 用户定义数据 object? null
PARENTITEM 父级对象 TreeItem? null