propertyGrid中List<>属性的显示问题

Forrest Gump plus 2021-03-26 01:51:50
我想让List中的数据直接显示,而不是通过集合编辑器来显示。
有没有大佬能提供解决思路

...全文
493 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
Forrest Gump plus 2021-03-29
  • 打赏
  • 举报
回复
引用 2 楼 兔子党逍遥 的回复:
如果你打不开外网,可以从我这里下载。
1,2,3,这三部分怎么修改啊
Forrest Gump plus 2021-03-29
  • 打赏
  • 举报
回复
红框2中的名称我已经修改好了
Forrest Gump plus 2021-03-29
  • 打赏
  • 举报
回复
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DXApplication5.entity
{
    [Category("AR-PACKAGE"), TypeConverter(typeof(PackageConverter))]
    public class Package
    {
        private string short_name;
        private string category;
        private List<TestBluePrintSet> testBluePrintSet;

        public Package() { }
        public Package(string short_name,string category)
        {
            this.category = category;
            this.short_name = short_name;
        }
        [Category("AR-PACKAGE")]
        public string Short_name
        {
            get
            {
                return short_name;
            }

            set
            {
                short_name = value;
            }
        }

        [Category("info"), Browsable(false)]
        public List<TestBluePrintSet> TestBluePrintSet
        {
            get
            {
                return testBluePrintSet;
            }

            set
            {
                testBluePrintSet = value;
            }
        }
        [DisplayName("TestBluePrintSet"),Category("info")]

        public TestBluePrintSet[] TestBluePrintSet1
        {
            get
            {
                if (testBluePrintSet == null)
                {
                    testBluePrintSet = new List<TestBluePrintSet>();
                    //return testBluePrintSet.ToArray();
                }
                /*
                else
                {
                    return testBluePrintSet.ToArray();
                }*/
                return testBluePrintSet.ToArray();
            }

            set
            {
                testBluePrintSet.Clear();
                testBluePrintSet.AddRange(value);
                //testBluePrintSet = value;
            }
        }
        [Category("info")]
        public string Category
        {
            get
            {
                return category;
            }

            set
            {
                category = value;
            }
        }
       
    }
    

}
我的类结构大约这样,我想问下怎样修改可以改变上图1,2,3红框中的名字
兔子-顾问 2021-03-27
  • 打赏
  • 举报
回复 1
Customized Display of Collection Data in a PropertyGrid 完美的针对你这个需要做了描述和实现方法,可以参考一下。

110,539

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧