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
|
Hi, Please see attached image. The propertygrid displays an object with 3 properties. Some information about the 3 properties:
I want all comboboxes to appear the same way, preferably as the one used for enum. How do I achieve that? Best Regards, Jan van de Pol
|
|
|
The difference between them is that the built-in enum editor allows the user to type into the text field. Rather irritatingly, recent versions of Windows use dramatically different displays for type-able and non-type-able combo boxes. For ElementType, if you implement GetStandardValuesExclusive to return false, the Property Grid will allow user typing, so will use the enum-style drop-down. If you dislike the implications of returning 'I will accept other values,' you will need to specify a property editor explicitly, as you do for SectionID. This may require some incantations to get it to pick up the standard values -- if you have a source code licence then take a look at the ListSelectEditorKey in Editors.Generic.xaml, otherwise let me know and I'll post the details here. For the SectionID property editor, just change the template to set IsEditable="True" on the combo box. |
|
|
Hi Ivan, Thanks for your quick response. By looking at the ListSelectEditorKey I have managed to style the combobox for SectionID exactly the same as for the enum. That works great. However setting GetStandardValuesExclusive to false does not allow the user typing. It stays in readonly mode (with it's associated style). Could it be that I do not have the latest WPF Elements installed? Beste regards, Jan |
|
|
Mea culpa, on looking at the code I see we do not currently support GetStandardValuesExclusive. I can look at adding this support but I recall some compatibility issues which is why I think we ended up always going with the read-only box for custom GetStandardValues implementations. You can get around this using a property editor to override the default choice of editor, or you could use a smart editor to automatically override it for all properties that implement GSV but return false from GSVE: http://www.mindscapehq.com/blog/index.php/2008/04/30/smart-editor-declarations-in-the-wpf-property-grid/ Sorry for the confusion! |
|
|
In my case I have thousands of different properties all of type string. Some need straight text editing, some list selection, and some list selection with text editing. And obviously the only way I have of determining the difference is the TypeConverter. It almost all works beautifully out of the box except for the pesky missing GetStandardValuesExclusive() check. The only way I could think of is to create a smart TypeEditor for string. In the BuildTemplate method I do sort of a hybrid of what the TypeEditor and the ObjectWrappingEditor are doing. For the ContentTemplateProperty I do the following.
Sadly I don't have access to the "ContainingGrid" so I have to lookup the DataTemplate through the application, which is a bit nasty. Also, this leads to a separate problem for the styles, because naturally the DataTemplates are not displayed using the proper theme. I found a workaround for that too, "finding" the appropriate style, and setting the HostStyleProperty. But it is at best a hack. And if the property grid DataTemplates are changed, my hack is not going to work very well. This seems to be quite a drastic solution to so small a problem. Are you quite sure that compatibility problem that you mention is the reason we can't add that check? Is there nothing else we can do? |
|
|
Hello Eliz Unfortunately there is a compatibility issue for us to support GetStandardValuesExclusive in the PropertyGrid. We can however make these kind of changes at major version releases, so I've put down a note to look into supporting this in the next version which is expected to be released early next year. Stick with what you're doing for now, and I'll let you know when this support is available. Jason Fauchelle |
|
|
Hello Eliz We've just released WPF Elements 6.0 which includes support for GetStandardValuesExclusive in the PropertyGrid. The trial version is available from here: http://www.mindscapehq.com/products/wpfelements/download Or if you are a WPF Elements customer, you can upgrade for free from your account page: http://www.mindscapehq.com/store/myaccount Jason Fauchelle |
|