* UIEditForm:代码生成增加ComboCheckedListBox类型

This commit is contained in:
Sunny 2021-10-28 10:52:29 +08:00
parent 51f7a3c6af
commit 3194ade098
5 changed files with 4 additions and 3 deletions

Binary file not shown.

Binary file not shown.

View File

@ -82,7 +82,7 @@ namespace Sunny.UI.Demo
option.AddCombobox("Info", "关联", infoList, "Name", "Id", "2"); option.AddCombobox("Info", "关联", infoList, "Name", "Id", "2");
option.AddSwitch("Switch", "选择", false, "打开", "关闭"); option.AddSwitch("Switch", "选择", false, "打开", "关闭");
option.AddComboTreeView("ComboTree", "选择", nodes, nodes[1].Nodes[1]); option.AddComboTreeView("ComboTree", "选择", nodes, nodes[1].Nodes[1]);
option.AddComboCheckedListBox("checkedList", "选择", checkedItems); option.AddComboCheckedListBox("checkedList", "选择", checkedItems, "CCC");
UIEditForm frm = new UIEditForm(option); UIEditForm frm = new UIEditForm(option);
frm.CheckedData += Frm_CheckedData; frm.CheckedData += Frm_CheckedData;

View File

@ -200,6 +200,7 @@ namespace Sunny.UI
edit.CheckBoxes = true; edit.CheckBoxes = true;
edit.DropDownStyle = UIDropDownStyle.DropDownList; edit.DropDownStyle = UIDropDownStyle.DropDownList;
edit.TreeView.Nodes.Clear(); edit.TreeView.Nodes.Clear();
edit.Text = info.Value?.ToString();
var obj = (ComboCheckedListBoxItem[])info.DataSource; var obj = (ComboCheckedListBoxItem[])info.DataSource;
foreach (var item in obj) foreach (var item in obj)
{ {

View File

@ -312,7 +312,7 @@ namespace Sunny.UI
Dictionary.TryAdd(info.DataPropertyName, info); Dictionary.TryAdd(info.DataPropertyName, info);
} }
public void AddComboCheckedListBox(string dataPropertyName, string text, ComboCheckedListBoxItem[] nodes, bool enabled = true, bool halfWidth = false) public void AddComboCheckedListBox(string dataPropertyName, string text, ComboCheckedListBoxItem[] nodes, string value, bool enabled = true, bool halfWidth = false)
{ {
if (Dictionary.ContainsKey(dataPropertyName)) if (Dictionary.ContainsKey(dataPropertyName))
throw new DuplicateNameException(dataPropertyName + ": 已经存在"); throw new DuplicateNameException(dataPropertyName + ": 已经存在");
@ -322,7 +322,7 @@ namespace Sunny.UI
DataPropertyName = dataPropertyName, DataPropertyName = dataPropertyName,
EditType = EditType.ComboCheckedListBox, EditType = EditType.ComboCheckedListBox,
Text = text, Text = text,
Value = nodes, Value = value,
Enabled = enabled, Enabled = enabled,
HalfWidth = halfWidth, HalfWidth = halfWidth,
DataSource = nodes DataSource = nodes