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
|
Right now we use a data type to associate a property with the editor we want for that property. Unfortunately that often means we have to derive dummy types for no purpose other than needing to tell the grid which editor to choose for that property. The grid does support some attributes like [Browsable(false)] and such. Any plans to add support for a custom attribute that can tell the grid which editor to use for a property? What would be fantastic is something along the lines of: [MindscapePropertyGridEditor("MyCustomEditor")] public Hashtable ItemsInList { get { return ....} etc. } |
|
|
We deliberately chose not to provide such an attribute for the reasons discussed in this thread: http://www.mindscape.co.nz/forums/Thread.aspx?PostID=1927 (scroll down to near the end). Of course we will continue to monitor customer feedback on this. In the meantime, there are a couple of possible approaches to avoid deriving dummy types: 1. If you know which properties you want to associate with specific editors, you can use a PropertyEditor instead of a TypeEditor. 2. You can create a smart editor as described at http://www.mindscape.co.nz/blog/index.php/2008/04/30/smart-editor-declarations-in-the-wpf-property-grid/. Your smart editor would look out for your custom attribute and its values, and reply appropriately to CanEdit. In both cases, if you are also providing a default TypeEditor for the property type (e.g. if you have a default editor for Hashtables, but want the ItemsInList property to get a special editor), you need to be conscious of ordering issues -- your PropertyEditor or smart editor needs to appear BEFORE the TypeEditor. (The property grid takes the first matching editor, not the "most specific.") Hope this helps! |
|