This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
This is potentially a "we-don't-do-that" scenario, but I thought I'd throw it out there to see if there's something really clever I'm just not seeing... I am using the Mindscape property grid which is editing a dynamically generated data-driven object. The object in question basically has "fields", which may be simple types, other objects (with fields), or collections of fields, and so on. Each field is presented through TypeConverters / CustomTypeDescriptors as a property, and we use the property grid to edit the object and it's children. Now, that's all great. Everything's "working" fantastically. However, on occasion we really want to "hide" the complexity of certain object types. Now, we can easily replace the "editor" part using the builtin support of editors to select templates, but on occasion we want to also provide pseudo-children for the node. For example - let's say one of my objects is a time/date range*. The type kinda looks like:
{ MyTime starttime } The way I *want* to present this is as follows
[+] myPropertyName | [datetime][calendarpicker] to [datetime][calendarpicker] So what I really *want* to do is have a custom editor be able to intercede itself and simulate the children that a node will display. Right now it doesn't really work since the grid internally creates all the nodes, populates all the children and relies on AllowExpand to filter it's children out. The only method I can think of is modifying the property grid source to delegate the Node creation to a NodeFactory that I can provide or something similar. However, I can't be the first to want to do this. Are there any other patterns you'd suggest?
thanks!
*NB: Made-up example - our types don't use dates at all so please don't be distracted by the specifics. |
|
|
PS:apologies for the preformatted misalignment. Your forum seems to hate my firefox install.
|
|
|
I'm assuming the lack of ideas means that I *am* the first to want to do this... Oh well. :) |
|
|
The usual way to do this would be with an ICustomTypeDescriptor or TypeConverter on the type, or a TypeConverter on the property (with the TypeConverter overriding GetPropertiesSupported and GetProperties overridden). E.g. public class MyParentClass { In your example, the TypeConverter would need to spin up a couple of fake properties of some custom MyDateTimeAndTimezone type, for which you could then provide a TypeEditor in the usual way. |
|
|
Yep, i was hoping not to go down this route since my object already had custom type converters etc just to make it work, but in the end I've added another layer on TOP of that.
Of course, now I have a new problem in that "deleting" a virtually-created-property from a base object is hard to cope with... :( |
|
|
"Deleting" a synthesised property in a derived type should be possible through the same type converter / type descriptor mechanism, shouldn't it? Or am I misunderstanding the problem? |
|
|
yes, "aadding" and "deleting" are just fine - getting the grid to refresh after such deletion is the issue (http://www.mindscape.co.nz/forums/Thread.aspx?ThreadID=3107)
|
|