|
本帖最后由 meigui1758 于 2021-4-22 09:12 编辑
- PopListGroup pg = null;
- var HasGroupTitle = false;
- //popTemplateList.Groups.Clear(); //直接用这句也会 报错 已添加了具有相同键的项
- while (popTemplateList.Groups.Count>0)
- { popTemplateList.Groups.RemoveAt(0); }
- //检查项目组是否存在
- foreach (PopListGroup pGroup in popTemplateList.Groups)
- {
- if (pGroup.Title.Equals("项目"))
- {
- HasGroupTitle = true;
- pg = pGroup;
- break;
- }
- }
- if (!HasGroupTitle)
- { pg = new PopListGroup() { Title = "项目", TitleVisible = false }; }
- while (pg.Items.Count > 0) //清除组内所有项目
- { pg.Items.RemoveAt(0); }
- foreach (var pTemplate in PubTemplateList)
- {
- pg.Items.Add(new PopListItem(pTemplate.MO001C));
- popTemplateList.Groups.Add(pg);
- }
- popTemplateList.ShowDialog(); //局部显示
复制代码
|
|