tags:

views:

52

answers:

1

In definition of FrameworkElement properties Width and MaxWidth default value is the same

(double)1.0/(double)0.0

But at runtime Width has NaN, whereas MaxWidth - Infinity. What differences between properties lead to such result?

A: 

Stray photons, maybe :)?

If you take a look on Double.NaN definition you'll see... surprise:

public const double NaN = (double) 1.0 / (double) 0.0;

And since it's a constant odds are good you are seeing it in Width definition. Whereas definition of MaxWidth is indeed 1/0 but another one.

That being said, you can define the same property with default value of Double.NaN and Reflector will say it's 1.0/0.0.

PS: Glad to see you here :).

Anvaka