I am wondering, what the design pattern is, when I have an object and want to be able to edit it in a GUI (dialogue, etc). I'm using C#.NET... Perhaps there are also some integrated features with visual studio 2008?
By using a PropertyGrid, I can attach an object to it (.SelectedObject). What I'm looking 开发者_运维知识库for is something similar: to let a gui automatically build about the object which is attached to it.
Any hints are most welcome! Regards, Greg
could it be you are looking for a ready-made control library to use?
It would be simply document-view (possibly in a MVC context if there is also going to be a controller).
The only special part is that you have a particularly dynamic/generic view (control).
If you really insist you could tangentially mention
- observer pattern (for 'observing' the change in selected object)
- visitor pattern (for 'visiting' the properties of the selected object)
but this starting to get in the realm of complete conjecture. I might even say that 'SpaghettiCodePattern' could be used in implementing this. It might, and it doesn't have to be.
I don't think (there is)/(you are looking) for a design pattern
Correct me if I am wrong, but I think the propertygrid is based on using reflection.
Your question is very general. There is pattern which is called naked object pattern, do you mean something like this?
Also have a look at these: Tool to generate a GUI (WinForms or WPF) from a class
精彩评论