tags:

views:

36

answers:

1

Why does WPF have its own Color class instead of just using Drawing.Color?

+1  A: 

I don't know for certain, but I suspect it is for two reasons:

First, Drawing.Color does not support automatic conversion to and from floating point for ARGB values or color arithmetic, and both were necessary for WPF. They could have modified Drawing.Color to include it, but:

Second, Drawing.Color pollutes its namespace with static instances of itself for the various common colors. WPF wisely moves this to a separate static class called Colors to hold these instances.

I think it's likely as simple as that. Besides, Win.Forms and GDI+ will (hopefully) one day be deprecated and pruned. When that happens, there will be trouble if there's a dependency on the old .DLL. Better to just copy-pasta and enhance.

Randolpho
If WPF were invented today they would have just forwarded the Color class to System.DLL, but I guess that wasn't an option back then.
Jonathan Allen