What is the xaml equivalent of MyProperty = double.MaxValue
?
I'm afraid I'll need to use something like MyProperty="{x:Static sys:Int32.MaxValue}"
, but not sure, and can't find the equivalent for double. Thanks.
Found:
add this in the namespaces section of the control to access System library:
... xmlns:sys="clr-namespace:System;assembly=mscorlib" ...
then, to set Maximum property of MyControl control in ctr namespace:
<ctr:MyControl Maximum="{x:Static sys:Double.MaxValue}"/>
Edit:
{x:Static sys:Double.PositiveInfinity}
works too, but I suspect it is not appropriate to use it in this context, it seems to be reserved for evaluation like if (x==Double.PositiveInfinity)
. Experts can elaborate...
{x:Static sys:Double.PositiveInfinity}
could be useful in case you have say some control setting MaxWidth
to some value and you want to reset it via XAML at some ancestor
This is because double.PositiveInfinity is the default value (not set) for
MaxWidth/
MaxHeight`.
I found this useful with Silverlight Media Framework to hide/show the video area (to just hear the audio). See relevant notes near the bottom of:
How to hide the video area of the Silverlight media framework player
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With