简体   繁体   中英

Wpf DoubleUpDown, value rounded automatically

I have a DoubleUpDown control (from wpf toolikt) in my window :

 <xctk:DoubleUpDown FormatString="F2" Increment="0.01" Minimum="0" Value="{Binding Main.Speed}"></xctk:DoubleUpDown>

where Main.Speed is a property like :

private double _speed;
public  double  Speed
{
    get
    { return _speed;  }
    set
    {
        _speed = value;
        RaisePropertyChanged("Speed");
    }
}

The problem is the value I fill with the keyboard are rounded. If I type 45.2 directly in the DoubleUpDown control, my property speed will be set with 45.00 value. If I use the Up Down arrow, everything works.

How to tell the DoubleUpDown to do not round my value ?

Thanks

You can use CultureInfo="en-US" to specify whether using '.' or ',', to avoid further mistakes. In my case, using a German system I have to use '.'

I got it, DecimalUpDown use the comma. So I have to type 45,2 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM