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
|
Hello, Please find attached a repro project. When running the application you will find a listbox on the left with two items. On the right you will find two propertygrids one is Mindscape the other is WinForms. Select one of the objects in the list. The propertygrids get populated. Note the property called TestDouble. It uses an attribute typeconverter derived from StringConverter. When using the Mindscape and selecting different dropdown items from the combobox, the values of the Textbox and Textblock at the bottom of the window are not changed. Also there is a red error box around the combobox. However using the WinForms propertygrid works fine. Thanks Oscar |
|
|
Hi Oscar, Thanks for sending through the repro project. Fortunately, this can easily be fixed at your end. Since the ViewModelBase property in question is type double, it is best for the GetStandardValues method in the converter to return a collection of double values, rather than string values. This can be done by changing your GetValues method to return a double[], and in the override of GetValues, change the strings into their double value equivalents. Simply doing this will allow your repro project to work as expected. And the WinForms property grid will continue working correctly too. The values provided by GetStandardValues should generally match the type of property that the values will be set to. The converter then provides the string conversion for displaying those values nicely to the user. The WinForms property grid is able to handle the case where the types don't match. We do not plan to support this case unless necessary - such as if it could not be solved at your end. Hope that helps you move forward with your project. Please let me know if you have further questions about this. -Jason Fauchelle |
|
|
Hi Jason, Thanks for the prompt response. The actual case is a bit more complicated. I used the double to keep it simple. However the actual case does use the StringConverter with the override methods as given in the repro project. Would you like me to try and give you a repro project with our actual case? This is a case that we do need it to work. Thanks Oscar |
|
|
Hi Oscar, Yes, if you send through a repro project, I can take a look at if it can also be updated in your app, or if it would require fixes to the PropertyGrid. -Jason Fauchelle |
|
|
Hi Jason, Please find attached the new repro project. I tried to go to a point where things where becoming to complex and had to hard code the rest in. I also tried to keep things to a minimum to avoid a lot of complexity. The new property you are looking at is called "public Guid GlobalObjFunGuid". And the typeconverter attribute is called "GlobalObjFunGuidConverter" Our application is basically divide into two main parts 1) UI supporting and 2) Data supporting. The code I work with is the UI supporting part. We are usually not allowed to change anything on the Data supporting side as this may have very deep implications. In the repro project the file Engine.cs can be thought of at the Data supporting side. Which includes the converter "GlobalObjFunGuidConverter". When you load the application look at the property in the propertygrid with the name "Global Objective Function Name". You will notice the difference between the Mindscape and Winforms propertygrid. Two things to also note is that in the Mindscape the values in the dropdown do not show but you can actually select them. So it is almost working. The other thing is that the StringConverter resembles the ExpandableObjectConverter implementation (i.e. both have combobox when using the StandardValues) and the support of ExpandableObjectConverter works well in Mindscape. As we are using it elsewhere. Please let me know if you need anything else. Hope you can change it on your end. Thanks Oscar |
|
|
Hi Jason, Just checking to see if you had a chance to look at the new repro project. Thanks Oscar |
|
|
Hi Oscar, Not yet. I will be looking into this for you today. -Jason Fauchelle |
|
|
Hi Oscar, Thanks for that repro project. Fortunately this scenario was a lot easier to fix up at our end compared to the previous repro. Basically your converter uses the type-descriptor-context to perform the conversion lookup, but we weren't passing that context through. A fix for this will be available in the next nightly build. Let me know how it goes. -Jason Fauchelle |
|
|
Thank you very much Jason. The fix works. ...Oscar |
|