We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

PositiveInfinity and NegativeInfinity as strings in DoubleTextBox

Thread ID:





121536 Dec 27,2015 03:24 PM Dec 31,2015 08:05 AM WPF 5
Tags: SfDataGrid
Carlos Fernando Consigli
Asked On December 27, 2015 03:24 PM


I'm using a GridNumericColumn which according to the online documentation uses a DoubleTextBox as value editor.
Is there a way to enter the double value PositiveInfinity (System.Double.PositiveInfinity) or NegativeInfinity (System.Double.NegativeInfinity) as a string in this field?
When populating the grid, the infinity values from database are shown in the grid as "79228162514264300000000000000.00". When the grid is scanned in backend, these values are read as infinity (System.Double.IsPositiveInfinity is true). However, if I enter edit mode and commit changes without actually modifying the value, in the cell these cells are no longer "infinity" when I test them in backend with System.Double.IsPositiveInfinity but instead, the same entered number which is 7.92281625142643E+28 is read.
Is there a way to allow entering the strings "Infinity" and "-Infinity" in the field? Maybe the solution is to just use a GridTextColumn in combination with an IValueConverter, but I'm just asking in case DoubleTextBox was already taking this in account with some option I'm missing.

Thanks in advance!


Ayyanar Sasi Kumar Jeyaraj [Syncfusion]
Replied On December 28, 2015 09:15 AM

Hi Fernando,

When you are binding maximum infinity value, the value is not displayed in view and its correctly displayed in edit mode. Is this the issue you are referring? Refer the below sample where we tried to reproduced this issue.

Sample: http://www.syncfusion.com/downloads/support/forum/121536/ze/Numeric_textbox_in_wpf1708064484

Could please confirm the issue to provide the fix?


Carlos Fernando Consigli
Replied On December 28, 2015 11:28 AM

Hi Ayyanar. Thanks for your quick answer.
I was referring to both the inability to enter (and read) the value (-/+)Infinity in the field as "Infinity" instead as a number, and the fact that if you only enter edit mode and commit changes, the value is no longer read as Infinity in the model.

Everything reduces to the fact that there is no way to enter the value Infinity in the fields that don't have Infinity as an initial value.  You can enter the number 79228162514264300000000000000.00 which is the one shown for initial "Infinities", and it will persist it in the model as 7.92281625142643E+28. In fact, in my opinion this last behaviour is correct because Infinity should be just "Infinity" and not be mapped to any natural number, and it is ok to persist 79228162514264300000000000000.00 as a number. I think the solution may be to show the string "Infinity" for infinity values, and to allow the user to enter the word "Infinity" (or -Infinity) in the field.
Of course, I understand that this may be a sort of a hard and breaking change, because of the "masked" nature of this control and because as it currently only takes numbers and decimal separators as inputs, it should necessarily start accepting characters to allow "Infinity" with all what that implies (validating for invalid strings, etc).


Sivakumar R [Syncfusion]
Replied On December 29, 2015 10:31 AM

Hi Fernando,

We have analyzed and your requirement to display infinity in GridNumericColumn can’t be achieved. But you can use GridTextColumn to display as you required. You can validate the editing by CurrentCellValidating event.

this.datagrid.CurrentCellValidating += Datagrid_CurrentCellValidating;

private void Datagrid_CurrentCellValidating(object sender, CurrentCellValidatingEventArgs args)


    if (args.Column.MappingName != "salary")


    double d;

    if(args.NewValue == null || !double.TryParse(args.NewValue.ToString(), out d))


        args.ErrorMessage = "Enter valid double value";

        args.IsValid = false;



Please let us know if you have any questions.


Carlos Fernando Consigli
Replied On December 30, 2015 11:26 AM

Perfect, thanks, I implemented that solution and it's working ok. Also, that way was not necessary to deal with the IValueConverter.
Thanks, I really appreciate you took time to help me.


Ayyanar Sasi Kumar Jeyaraj [Syncfusion]
Replied On December 31, 2015 08:05 AM

Hi Fernando,
Thanks for the update.
Please let us know if you have any further assistance.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.