Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Allow only integer value in NumericUpAndDown Mahapp doesn't working properly

I'm using the Framework Mahapps.Metro, in the documentation for disable the decimal value there is a property: HasDecimals, I set it to False but if I type: 5.01 the control allow me to insert this value. Maybe it's a bug?

<Controls:NumericUpDown x:Name="Timer" Minimum="5" Value="15" HasDecimals="False" Maximum="1440"  />

Also I want ask how can I disable the scientific value, so accept only integer. Is possible do this via XAML? Or How can I do this behind code?

like image 976
IlDrugo Avatar asked Jul 10 '26 15:07

IlDrugo


2 Answers

Was looking for this as well recently but thought I'd share what I found for anyone else that's looking. The HasDecimals property will be removed in an future release, thus you should use the NumericInputModeproperty instead like below.

<Controls:NumericUpDown Value="50" Interval="1" NumericInputMode="Numbers"/>
like image 70
Teekzilla Avatar answered Jul 12 '26 08:07

Teekzilla


Try this works for me

<Controls:NumericUpDown Minimum="0" Maximum="10" Interval="1" HasDecimals="False"/>

like image 26
Jas121 Avatar answered Jul 12 '26 08:07

Jas121



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!