RadNumericUpDown - problem with negative values and French Keyboard

4 posts, 0 answers
  1. Tom
    Tom avatar
    2 posts
    Member since:
    Oct 2015

    Posted 07 Mar Link to this post

    Greetings. 

    We are using a RadNumericUpDown in a Silverlight application. Usually users enter positive decimal values. A French user reported being unable to enter negative values. We have tested this and found the following

    - Normally (for example US or UK keyboard) the minus key toggles the sign of the value in the control

    - When set to French, users press the shift key to obtain number characters - the control behaves correctly

    - When set to French, the minus key is in the same position as the 6 key in US/UK keyboards and it does not toggle the sign of the value

    - The minus key in the numeric keypad work correctly but most of our users use laptops and this is not an option

    - This issue was replicated by setting the keyboard to French and with the OnScreen keyboard

    - The minus character can be pasted into the control.

    - The RadNumericUpDown does not appear to have any culture properties.

    We have not found any mention of this issue in the Telerik forums (most keyboard issues related to decimal or thousands separators and are culture related)

    Can anyone else replicate this issue? Does anyone have a work around besides copy-pasting the minus key?

    Thanks in advance

    Tom

  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 09 Mar Link to this post

    Hi Tom,

    Indeed, we haven't received such a feedback about NumericUpDown control and French keyboard until now. We have tested the case in a simple application, however, we did not manage to replicate the issue - the NumericUpDown accepted the minus without a problem ( with the OnScreen Keyboard as well as the actual keyboard).  Can you send us the definition of the NumericUpDown? Do you have any Culture settings in the application?

    Regards,
    Yana
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. DevCraft banner
  4. Tom
    Tom avatar
    2 posts
    Member since:
    Oct 2015

    Posted 09 Mar in reply to Yana Link to this post

    Hi Yana, 

    Thanks for your response. I should have tried the control in a simple application myself! The control is set within a template selector:

    <template:NumericTemplateSelector x:Key="NumericTS">
        <template:NumericTemplateSelector.NumericTemplate>
            <DataTemplate>
                <telerik:RadNumericUpDown IsEnabled="{Binding IsAmountEnabled}" Value="{Binding Amount, Mode=TwoWay}" ShowButtons="False" ValueFormat="{Binding SelectedCalculationType.StringFormat}" NumberDecimalDigits="{Binding SelectedCalculationType.DecimalPlaces}"/>
            </DataTemplate>
        </template:NumericTemplateSelector.NumericTemplate>
        <template:NumericTemplateSelector.PercentageTemplate>
            <DataTemplate>
                <telerik:RadMaskedNumericInput IsEnabled="{Binding IsAmountEnabled}" Value="{Binding Amount, Mode=TwoWay}" FormatString="{Binding SelectedCalculationType.StandardStringFormat}" Mask="" TextMode="MaskedText" InputBehavior="Replace"  IsTabStop="False"  />
            </DataTemplate>
        </template:NumericTemplateSelector.PercentageTemplate>
    </template:NumericTemplateSelector>

    As you might expect, data types are:

    IsAmountEnabled - bool

    Amount - decimal?

    SelectedCalculationType.StringFormat - string

    SelectedCalculationType.DecimalPlaces - int

    The template is used by a GridView column definition:

    <telerik:GridViewDataColumn UniqueName="Amount" Header="{extensions:ResxEx ResxKey=Resource_AmountHeader ,Default=Amount}" CellEditTemplateSelector="{StaticResource NumericTS}"  DataMemberBinding="{Binding FormatedAmount, Mode=TwoWay}" IsReadOnlyBinding="{Binding RowReadOnly}" >
        <telerik:GridViewDataColumn.ToolTipTemplate>
            <DataTemplate>
                <Views:CustomContentControl Style="{StaticResource tooltipStyle}">
                    <Views:CustomContentControl.ToolTipContent>
                        <TextBlock Text="{Binding FormatedAmount, Mode=TwoWay}"/>
                    </Views:CustomContentControl.ToolTipContent>
                </Views:CustomContentControl>
            </DataTemplate>
        </telerik:GridViewDataColumn.ToolTipTemplate>
    </telerik:GridViewDataColumn>

    Data types are:

    FormatedAmount - string

    RowReadOnly - bool

    here is the getter for the FormatedAmount, I have removed some other logic which deals with nulls and other situations I don't think are relevant here.

    public string FormatedAmount
    {
        get
        {
            NumberFormatInfo format = (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clone();
            format.CurrencySymbol = SelectedFX.Symbol;
            return Amount.ToString("c",format);
        }
    }

    While we do have culture settings in the app, I was able to reproduce the issue for both a client where culture is used and one which does not use it. As you can see from the getter code, the culture is harvested from the user's machine - so the appearance of decimals (e.g. "," or ".") and thousands separators ("," or " ' ") is usually not an issue. I assume the user who reported this has their culture as french a screen shot they sent shows "7,00%". I have replicated the bug with my own culture, en-UK.

    Thank you for your ongoing help.

    Tom

     

     

     

  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 14 Mar Link to this post

    Hi Tom,

    I have tried the provided code, still I wasn't able to reproduce the described issue with the  French keyboard. Note that you will need to set additionally the CurrencyNegativePattern property of the used NumberFormatInfo as shown in the following MSDN topic:
    https://msdn.microsoft.com/en-us/library/system.globalization.numberformatinfo.currencynegativepattern%28v=vs.110%29.aspx

    in order to visualize the negative values as needed.  I have attached my test project, please download it and give it a try.

    Regards,
    Yana
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top