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
|
I have been using the WinForms property grid and using a TypeConverter to provide a list of possible values for a property (the type converter fetches the list from the database). The WinForms property grid then will display these values in a drop down list for selection. Is there anyway to get this to work with the WPFPropertyGrid? I am using the latested nightly build for this. Regards, Cain |
|
|
We don't currently support TypeConverter, but you can achieve the same behaviour using TypeEditors or PropertyEditors as appropriate -- create a DataTemplate containing a ComboBox whose ItemsSource is bound to the same code that already exists within your TypeConverter. I will also look into supporting TypeConverters automatically, but it would be useful if you could let me know what you would need from an implementation -- e.g. do your TypeConverter.GetStandardValues implementations only ever return simple types like strings or integers, or are there richer types involved? Do you place any reliance on the ITypeDescriptorContext passed to GetStandardValues? Do you also override other TypeConverter methods such as GetProperties, ConvertTo/FromString, etc.? This will give us some idea of what effort would be required to support type converters directly within the grid. Thanks! |
|
|
Thanks for your reply. I have it working with a PropertyEditor as you suggested. It is good for a short term solution but means I would need to dynamically add these at runtime depending on what object is passed to the property grid. In my sceneraio, say for example I have a class called "Department" which has a collection of "Locations". The Location object having a property which is a "Department". I use a type converter (and the GetStandardValues(...)) which is applied to the "Department" property such that it can pull out a list of the Departments from the database. I also use the ConvertTo and ConvertFrom (to and from strings) in order to display the Department's name and then when the type converter tries to set the new department via its name then the type converter convertes the name back into a department object. Do you have a public roadmap for the product so we can see when features like this may be available? |
|
|
Thanks for the additional detail, and good to hear that you have an interim solution working. It sounds like your use case is relatively simple and would not require us to address all the features of TypeConverter, so we will try to get this into a nightly build shortly. |
|
|
Hi Cain, I'll address your public road map query. We have adopted a demand driven approach to product enhancements - feedback from customers is the best indication of what can be improved upon. If a request is made for something that we believe would help other customers then we promptly add the requested functionality to the current product (Currently the nightly build of the Property Grid contains many of these types of additions and other forum threads will show that we are reasonably fast at making these enhancements). This is not to say that we do not have plans for the direction of a product, we just do not comment on major enhancements until we are certain that we will be delivering on them. Thank-you for your feature request - I encourage you to continue posting on any other features you would like to see. John-Daniel |
|
|
We have now added support for value selection using using TypeConverter.GetStandardValues and ConvertTo/ConvertFrom. (We don't at this stage support non-exclusive standard values: that is, we only allow users to choose from the list returned by GetStandardValues, we don't allow users to enter their own values.) This support is included in nightly builds beginning from 20080417, which will available at http://www.mindscape.co.nz/Products/WpfPropertyGrid/nightlybuilds.aspx from about 18:00 GMT. Let us know if this level of support doesn't meet your requirements or if you run into any problems. (If you do find any problems to report then if you could attach a repro case it would help us to address the issue more quickly.) |
|
|
Hi, Thanks for you quick turnaround on that. Unfortunately it doesnt support exactly what the WinForms property grid does and with what I required. I have attached a sample solution which has a WPF app with your property grid and also one with the WinForms property grid. In my example I have 2 classes, a Department and a Location. The Location having a Department property. To get it to work with what you have implemented I need to apply the TypeConverter to the Department class at the class level. This then means that when I pass in a Department object to the grid nothing is displayed. The WinForms grid allows me to specify the TypeConverter on the "Department" property on the Location object which then works as expected. You can see this is my example solutions. Regards, Cain |
|
|
Hi Cain, Thanks for the clarification and the sample. Sorry I misunderstood the requirement earlier. We have now added support for type converters at the property level, and it will be available in nightly builds numbered 20080418 and above (again, should appear on the nightly builds page around 18:00 GMT). As always, please let us know if you run into any problems. |
|
|
Hi ivan, Thanks - this now works. One question though, how come the editor for this isnt the same as the default editor for displaying bool's and enum's (the ListSelectedEditorKey?). This list shows as a normal combobox which I know I can change the style of also. Regards, Cain |
|
|
I have to admit it was down to time rather than a deliberate intention. We would have liked to use the same editor, and originally started that way, but ran into some nasty interactions between the Text and SelectedItem properties. Making the combo box non-editable resolved these problems and we felt that this limitation was an acceptable trade-off for getting the feature out the door. It's not ideal, and we hope to revisit it as a fit-and-finish issue when we wrap it up into a formal v1.1 release, but that will depend on the effort involved. |
|