Can't enter Negative values

8 posts, 0 answers
  1. Koren
    Koren avatar
    68 posts
    Member since:
    Oct 2010

    Posted 25 Jun 2012 Link to this post

    I am upgrading from Q3 2011 to Q2 2012 and ran into a problem with the numeric input.  I cannot enter a negative value into my textboxes.  It doesn't throw an error - it just ignores the negative sign.  I have tried the number pad and the regular keyboard and I have tried entering the negative first and entering it last.  Nothing seems to work.
    See below for an example of one of the text boxes.  I checked the value in the validator and it is positive there so it isn't the validator changing the value.

    <telerik:GridViewDataColumn DataMemberBinding="{Binding Units}" DataFormatString="{}{0:f2}" IsFilterable="False" Width="80"
                                                IsReadOnlyBinding="{Binding HideUnits}">
                        <telerik:GridViewDataColumn.Header>
                            <TextBlock Text="Units" TextWrapping="Wrap" />
                        </telerik:GridViewDataColumn.Header>
                        <telerik:GridViewDataColumn.CellEditTemplate>
                            <DataTemplate>                                                      
                                <telerikInput:RadMaskedNumericInput x:Name="txtUnits" Mask="#9.2"
                                                                    SpinMode="None" IsClearButtonVisible="False" SelectionOnFocus="SelectAll"
                                                                    KeyboardNavigation.TabNavigation="Local" TextMode="PlainText"                                                               
                                                                    Validation.ErrorTemplate="{StaticResource TextBoxErrorTemplate}" 
                                                                     >
                                    <telerikInput:RadMaskedNumericInput.Value>
                                        <Binding Path="Units" Mode="TwoWay" UpdateSourceTrigger="LostFocus">
                                            <Binding.ValidationRules>
                                                <imKASHelper:DoubleValidationRule Min="-100000000.00" Max="100000000.00" />
                                            </Binding.ValidationRules>
                                        </Binding>
                                    </telerikInput:RadMaskedNumericInput.Value>
                                </telerikInput:RadMaskedNumericInput>
     
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellEditTemplate>
                    </telerik:GridViewDataColumn>

  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 28 Jun 2012 Link to this post

    Hi Koren,

    Please accept our apology for this inconvenience. This is a known issue that was introduced with the Q2 2012 release. However, we've already addressed it in our latest internal build.

    And until the next official release is out, you can set the minimum and maximum value of the control as a workaround:
    <telerikInput:RadMaskedNumericInput
                    xmlns:ext="clr-namespace:Telerik.Windows.Controls.MaskedInput;assembly=Telerik.Windows.Controls.Input"

                    x:Name
    ="txtUnits"
                    ext:MaskedInputExtensions.Maximum
    ="2147483647"
                    ext:MaskedInputExtensions.Minimum
    ="-2147483648"
                    IsClearButtonVisible
    ="False"
                    KeyboardNavigation.TabNavigation
    ="Local"
                    Mask
    ="#9.2"

                    SelectionOnFocus
    ="SelectAll"
                    SpinMode
    ="None

                    TextMode
    ="PlainText"

                    Validation.ErrorTemplate
    ="{StaticResource TextBoxErrorTemplate}"

                    Value
    ="5">
    ...
            </telerikInput:RadMaskedNumericInput>

    Give this a try and let us know if it helps.

    Kind regards,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Koren
    Koren avatar
    68 posts
    Member since:
    Oct 2010

    Posted 10 Jul 2012 Link to this post

    This helped a little.  However, I can't type in the negative sign first like we could before.  I can type in 3- but not -3.  This will be confusing for our users who are used to it working either way.
    Thanks.
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 13 Jul 2012 Link to this post

    Hello Koren,

     In a sample scenario am not able to reproduce such issue (you can heck out the attached sample).
    Do you use custom culture? If yes, you can check out this msdn page describing the different CurrencyNegativePatterns you can have. In the code behind of the attached project you can also see how to define custom culture (the commented lines in the MainWindow.xaml.cs).

    Greetings,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Koren
    Koren avatar
    68 posts
    Member since:
    Oct 2010

    Posted 13 Jul 2012 Link to this post

    The sample you sent did not have the numeric input in a column of a telerik gridview. 

    here is an example... 

    <telerik:GridViewDataColumn DataMemberBinding="{Binding Units}" DataFormatString="{}{0:f2}" IsFilterable="False" Width="80"
                                                IsReadOnlyBinding="{Binding HideUnits}">
                        <telerik:GridViewDataColumn.Header>
                            <TextBlock Text="Units" TextWrapping="Wrap" />
                        </telerik:GridViewDataColumn.Header>
                        <telerik:GridViewDataColumn.CellEditTemplate>
                            <DataTemplate>                                                      
                                <telerikInput:RadMaskedNumericInput x:Name="txtUnits" Mask="#9.2"
                                                                    SpinMode="None" IsClearButtonVisible="False" SelectionOnFocus="SelectAll"
                                                                    KeyboardNavigation.TabNavigation="Local" TextMode="PlainText"                                                               
                                                                    Validation.ErrorTemplate="{StaticResource TextBoxErrorTemplate}" 
                                                                    telerikMaskedInput:MaskedInputExtensions.Minimum="-2147483648"
                                                                    telerikMaskedInput:MaskedInputExtensions.Maximum="2147483648">
                                    <telerikInput:RadMaskedNumericInput.Value>
                                        <Binding Path="Units" Mode="TwoWay" UpdateSourceTrigger="LostFocus">
                                            <Binding.ValidationRules>
                                                <imKASHelper:DoubleValidationRule Min="-100000000.00" Max="100000000.00" />
                                            </Binding.ValidationRules>
                                        </Binding>
                                    </telerikInput:RadMaskedNumericInput.Value>
                                </telerikInput:RadMaskedNumericInput>
     
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellEditTemplate>
                    </telerik:GridViewDataColumn>
  7. Nathan J Pledger
    Nathan J Pledger avatar
    95 posts
    Member since:
    Apr 2006

    Posted 16 Jul 2012 Link to this post

    Hi Tina and Petar,

    I am also having this issue.

    My XAML:

    <telerik:RadMaskedCurrencyInput FormatString="#9.2"  SelectionOnFocus="SelectAll"  SpinMode="None" UpdateValueEvent="PropertyChanged"
                                                                    Value="{Binding NetPricePerUnit, Mode=TwoWay, UpdateSourceTrigger=Explicit}" />


    I find it concerning that your product has essentially regressed, so your unit testing/use of your own test tools is perhaps not as stringent as it could be?

    However, that aside, without any fixes/workarounds that ultimately may impact the quality of our product, when can we expect a fix?

    Thanks,

    Nathan
  8. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 18 Jul 2012 Link to this post

    Hello guys,

    Firstly I want to assure you that this issue is already fixed and you can both test it with the latest internal build. The fix will be officially out with the upcoming Q2 2012 SP1 release.

    @Nathan - in the meantime you can use the same workaround I suggested to Koren:
    <telerik:RadMaskedCurrencyInput xmlns:telerikMaskedInput="clr-namespace:Telerik.Windows.Controls.MaskedInput;assembly=Telerik.Windows.Controls.Input"
                                    SelectionOnFocus="SelectAll"
                                    SpinMode="None"
    telerikMaskedInput:MaskedInputExtensions.Maximum="2147483648"
    telerikMaskedInput:MaskedInputExtensions.Minimum="-2147483648"
                                    UpdateValueEvent="PropertyChanged"
                                    Value="{Binding NetPricePerUnit,
                                                    Mode=TwoWay,
                                                    UpdateSourceTrigger=Explicit}" />
    I also noticed that you've defined a FormatString for the control - by default the Mask of the CurrencyInput control is #9.2 so you don't really need to apply any kind of FormatString properties.

    @Koren - I wasn't able to reproduce the issue but I noticed that the Width you've applied on the GridViewDataColumn is too small and it can't display the minus sign in front of the control. So I changed that Width to 100 and I was able to successfully set and see the minus sign as soon as I enter the cell for editing. I attached my solution so that you can have a look at it and let me know if it works for you.

    All the best,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  9. Koren
    Koren avatar
    68 posts
    Member since:
    Oct 2010

    Posted 18 Jul 2012 Link to this post

    That appears to work.  I will have to adjust the width of all my grid columns with numeric input.  The negative must have been right beside the number before rather than at the front like it is now.
    Thanks!
Back to Top
UI for WPF is Visual Studio 2017 Ready