示例#1
0
        public FormMain()
        {
            InitializeComponent();

            var properties = new GenericPropertyCollection();

            properties.Add(new GenericProperty()
            {
                ScopeName           = "options",
                CategoryName        = "person",
                CategoryDisplayName = "Personal Information",
                Name         = "firstName",
                DisplayName  = "First Name",
                Type         = GenericPropertyType.String,
                DefaultValue = "David"
            });

            properties.Add(new GenericProperty()
            {
                ScopeName           = "options",
                CategoryName        = "person",
                CategoryDisplayName = "Personal Information",
                Name         = "lastName",
                DisplayName  = "Last Name",
                Type         = GenericPropertyType.String,
                DefaultValue = "Brown"
            });

            properties.Add(new GenericProperty()
            {
                ScopeName           = "options",
                CategoryName        = "detailedInformation",
                CategoryDisplayName = "Detailed Information",
                Name         = "age",
                DisplayName  = "Age",
                Type         = GenericPropertyType.Integer,
                DefaultValue = 0
            });

            properties.Add(new GenericProperty()
            {
                ScopeName           = "options",
                CategoryName        = "detailedInformation",
                CategoryDisplayName = "Detailed Information",
                Name         = "gender",
                DisplayName  = "Gender",
                Type         = GenericPropertyType.Enumeration,
                DefaultValue = "male",
                EnumItems    = new List <GenericPropertyEnumItem>()
                {
                    new GenericPropertyEnumItem()
                    {
                        Name  = "Male",
                        Value = "male"
                    },
                    new GenericPropertyEnumItem()
                    {
                        Name  = "Female",
                        Value = "female"
                    }
                }
            });

            properties.Add(new GenericProperty()
            {
                ScopeName           = "options",
                CategoryName        = "detailedInformation",
                CategoryDisplayName = "Detailed Information",
                Name         = "retarded",
                DisplayName  = "Retarded",
                Type         = GenericPropertyType.Boolean,
                DefaultValue = true
            });

            properties.Add(new GenericProperty()
            {
                ScopeName           = "options",
                CategoryName        = "detailedInformation",
                CategoryDisplayName = "Detailed Information",
                Name            = "outputPath",
                DisplayName     = "Output Path",
                PathDescription = "Select path",
                Type            = GenericPropertyType.Path,
                DefaultValue    = "c:\\"
            });

            properties.Add(new GenericProperty()
            {
                ScopeName           = "options",
                CategoryName        = "detailedInformation",
                CategoryDisplayName = "Detailed Information",
                Name         = "eyeColor",
                DisplayName  = "Eye Color",
                Type         = GenericPropertyType.Color,
                DefaultValue = Color.Blue
            });

            genericPropertyListControl1.Properties = properties;
            genericPropertyListControl1.RefreshItems();
        }