* UIComboTreeView: 显示清除按钮

This commit is contained in:
Sunny 2023-04-02 20:35:58 +08:00
parent 70eb76fa9e
commit 81dbcbf0e3
2 changed files with 30 additions and 5 deletions

View File

@ -607,12 +607,19 @@ namespace Sunny.UI
{
NeedDrawClearButton = false;
Text = "";
if (!showFilter)
dropForm.ListBox.SelectedIndex = -1;
else
filterForm.ListBox.SelectedIndex = -1;
Invalidate();
if (!showFilter)
{
while (dropForm.ListBox.SelectedIndex != -1)
dropForm.ListBox.SelectedIndex = -1;
}
else
{
while (filterForm.ListBox.SelectedIndex != -1)
filterForm.ListBox.SelectedIndex = -1;
}
Invalidate();
return;
}

View File

@ -23,6 +23,7 @@
* 2022-07-12: V3.2.1 CanSelectRootNode时可以展开子节点
* 2022-11-30: V3.3.0 Clear方法
* 2023-02-04: V3.3.1
* 2023-04-02: V3.3.4
******************************************************************************/
using System;
@ -61,6 +62,14 @@ namespace Sunny.UI
this.PerformLayout();
}
[DefaultValue(false)]
[Description("显示清除按钮"), Category("SunnyUI")]
public bool ShowClearButton
{
get => showClearButton;
set => showClearButton = value;
}
[DefaultValue(true)]
[Description("下拉框显示全选选择框"), Category("SunnyUI")]
public bool ShowSelectedAllCheckBox { get; set; } = true;
@ -215,6 +224,15 @@ namespace Sunny.UI
private void UIComboTreeView_ButtonClick(object sender, EventArgs e)
{
if (NeedDrawClearButton)
{
NeedDrawClearButton = false;
Text = "";
TreeView.SelectedNode = null;
Invalidate();
return;
}
ItemForm.Size = ItemSize;
//item.TreeView.ExpandAll();
item.CanSelectRootNode = CanSelectRootNode;