Found why I got the cast error.
I had added the colors using the combobox control as well as programmatically.
However, instead of the color being displayed it just says: 'PDFSharp.Drawing.XColor'
Any suggestions why as it seems to be correct?