I have a user control with an exposed double dependency property. If I attempt to assign a large value to it:
<UserControl Value="98765432.10"/>
It builds and runs but I get the number "98765432.0" in the setter. Smaller values work fine. If I pass the same large number into the control using the code-behind, it also works fine.
Does XAML not parse doubles correctly?
Try declaring the double value as a WindowResource. You'll need to import the "mscorlib" namespace.
<Window x:Class="WpfApplication5.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:core="clr-namespaceystem;assembly=mscorlib"
Title="Window1" Height="700" Width="900">
<Window.Resources>
<core:Double x:Key="myDouble">98765432.10</core:Double>
</Window.Resources>
<UserControl Value="{StaticResource myDouble}"/>
</Window>
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