private void LoadPropertyGrid() { bag = new BasicPropertyBag(); for (int i = 0; i < gridList.Count; i++) { string type = gridList[i].DataType.Trim().ToLower(); bag.Properties.Add(new MetaProp(gridList[i].CodeName.ToString(), typeof(string), new DefaultValueAttribute(gridList[i].CodeName.ToString()), new TypeConverterAttribute(Enums.GetType(type)), new CategoryAttribute(gridList[i].Category.ToString()), new DisplayNameAttribute(gridList[i].Name.ToString()), new DescriptionAttribute(gridList[i].Desc.ToString())) ); bag[gridList[i].Default] = "Distribute"; bag[gridList[i].CodeName] = gridList[i].Value; } propertyGridMain.SelectedObject = bag; propertyGridMain.CollapseAllGridItems(); }