Operator '==' cannot be applied to operands of type 'OxyPlot.OxyColor' and 'null' (MonoTouchDemo)

Oct 31, 2013 at 4:19 PM
The MonoTouch Demo won't build because of the above error. It seems that OxyColor isn't NULLable, but there are statements where it's compared to NULL, which crashes it. When I change this to oxycolor.Equals(null) it build, but crashes (obviously) when I'm trying to draw a graph.

I would expect since its not NULLable, there would be a value like 'undefined' which can be chosen instead, but this doesn't seem to be the case.

How can this be solved?
Coordinator
Oct 31, 2013 at 5:21 PM
OxyColor was recently changed to a value type. Try to use OxyColors.Undefined where no color should be applied and OxyColors.Automatic where OxyPlot should suggest or a default color should be used. Let me know where to correct the MonoTouch code, I cannot compile this myself.
Nov 1, 2013 at 10:17 AM
Hi I've fixed it, I tried to upload the changes thru the fork feature here on codeplex, but I couldn't figure out how to update it through SVN.
Anyways, replacing OxyPlot.MonoTouch\MonoTouchRenderContext.cs by this should fix it.

I replaced the
foo != null
by
!foo.Equals(OxyColors.Undefined)
etc.

I've ran the demo on an iOS simulator, and didn't run into any bugs,
although the resolution seems a kinda low compared to the MonoForAndroid version.
Coordinator
Nov 1, 2013 at 6:59 PM
Thanks, I submited a fix with some modifications (using the OxyColor.IsVisible method), let me know if I broke something...
Nov 2, 2013 at 8:34 AM
Edited Nov 2, 2013 at 4:16 PM
It's nearly correct, you just forgot to add the
using System;
I forgot to mention that I changed it, it's needed for the Math.PI at line 183.

For as far as I've tested it nothing else seems to be wrong, I'll let you know if I find something.

Edit:
  • The Microsoft.CSharp Reference in ExampleLibraryMT.csproj should be removed, it gives an error, but the project runs fine without the reference.
  • There is no 'splashscreen' for iPhone 5 resolution included.