system.componentmodel

When and why should I implement IComponent, IContainer, and ISite?

故事扮演 提交于 2019-11-28 08:10:29
I've wondered for a long time what IComponent, IContainer, and ISite are for. I've read the documentation, but it is extremely vague (or I'm thinking about it too hard). I know that if I create a class as a component, it can be used in the Visual Studio designer. But I'd really like to know more generally: what does the Component/Container pattern accomplish, and can it make my life easier? They are plumbing for the Windows Forms designer. You rarely have to implement them yourself, just derive your component class from Component. Start worrying about them when you want to implement your own

When and why should I implement IComponent, IContainer, and ISite?

荒凉一梦 提交于 2019-11-27 02:06:22
问题 I've wondered for a long time what IComponent, IContainer, and ISite are for. I've read the documentation, but it is extremely vague (or I'm thinking about it too hard). I know that if I create a class as a component, it can be used in the Visual Studio designer. But I'd really like to know more generally: what does the Component/Container pattern accomplish, and can it make my life easier? 回答1: They are plumbing for the Windows Forms designer. You rarely have to implement them yourself, just

How to add property-level Attribute to the TypeDescriptor at runtime?

本秂侑毒 提交于 2019-11-26 09:44:36
问题 I want to add some custom PropertyGrid-centric Attributes to the object\'s properties, to provide richer editing, hide some values and group them in categories, because that class I\'m working with doesn\'t provide such functionality and I can\'t do anything about it. Really, it\'s for MS\'s Application Settings that generates code, so you can\'t extend it in any way property-wise. See my other question: Runtime AppSettings.settings editor dialog 回答1: Unlike others have suggested, it's quite