Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 1751

Summary: Invalid cast in PropertyGrid and ChartPen object
Product: .NET TeeChart Reporter: sdgr
Component: ChartAssignee: Steema Issue Manager <issuemanager>
Status: RESOLVED WORKSFORME    
Severity: major CC: chris
Priority: ---    
Version: TeeChart for .Net 4.1.2015.12165   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Chart Series: --- Delphi / C++ Builder RAD IDE Version:
Attachments: Screenshot
Form2
screenshot

Description sdgr 2017-01-17 02:56:01 EST
Created attachment 695 [details]
Screenshot

Hi,

I was using a DevExpress PropertyGrid and remarked a problem when displaying a ChartPen object in a PropertyGrid (Winforms).
When modifying the property 'Fill', closing the editor, I get an exception 'Invalid cast from 'System.Boolean' to 'Steema.TeeChart.Drawing.ChartBrush'. 
When opening the 'Fill' property and using the 'Gradient' editor, closing it, I also get an invalid cast error.

This is code I used:
      Points3D series = new Points3D(tChart.Chart);
      series.FillSampleValues(10);
      Steema.TeeChart.Drawing.ChartPen pen = series.LinePen;             
      propertyGrid1.SelectedObject = pen; 

At first, I reported this to DevExpress, and this was their answer:

On the other hand, it is better to contact the TeeChart team and inform them that the PenComponentEditor.EditValue method is implemented absolutely incorrectly. In accordance with the UITypeEditor.EditValue Method (ITypeDescriptorContext, IServiceProvider, Object) article, the method should return a value of the same type as the Value parameter has. 

I have also added a screenshot of the error.
Is there something that can be done to avoid the errors?
Thanks,
Stefan
Comment 1 christopher ireland 2017-01-24 05:39:57 EST
Created attachment 699 [details]
Form2

Hello Stephan,

Please find attached Form2, which when run against the TeeChart source code gives me the following:

https://www.screencast.com/t/HFtCdvS4

This is an error which I will fix, but it is not the error that you report. Could you please modify the Form so that I can reproduce your error here?

Thank you.
Comment 2 christopher ireland 2017-01-24 05:52:09 EST
Apologies for misspelling your name, Stefan.
Comment 3 sdgr 2017-01-24 06:40:47 EST
No problem ;)

Is there a way where I can post my project, including the used DevExpress components? I zipped it (13 Mb), but it is bigger than the allowed 2 Mb for attachments.

Thanks
Comment 4 christopher ireland 2017-01-25 04:15:18 EST
Yes, of course - you can use Steema's upload page here:

http://www.steema.net/upload/
Comment 5 sdgr 2017-01-25 05:06:34 EST
I have uploaded my solution 'WindowsFormsApplication22' and 5 additional zip files. Unpack the 5 DevExpess zipfiles in the \Bin\Debug folder of my project.
If you need additional info, please let me know.

Stefan
Comment 6 christopher ireland 2017-01-26 05:45:22 EST
Created attachment 702 [details]
screenshot

Hello Stefan,

In order to run your project I was forced to install an evaluation version of DevExpress's Winform controls, as without a license the DevExpress assemblies you sent would not run. Having made the installation, I received the image attached (screenshot) when first running your project. I assented to the upgrade, made a couple of adjustments to your code, and then ran your project with this result:

https://www.screencast.com/t/RUvxAQrZv

as you can see, DevExpress's property grid, in the 16.2.4 version, did not throw any errors.
Comment 7 sdgr 2017-01-26 09:14:35 EST
Hi Christopher,
Thanks for the effort you put in this issue: you're right, with the latest version I can't reproduce it either. 
The message is to upgrade to their latest version to avoid the exceptions :).
Thanks again,
Stefan
Comment 8 christopher ireland 2017-01-26 09:34:40 EST
Hello Stefan,

You're very welcome. Unlucky that an upgrade may be the only way to solve this one :)

Thanks,

Chris.