Telerik Forums
UI for WPF Forum
0 answers
1 view
I have a simple NumericUpDown control showing milliseconds.  I use a 'ms' custom unit to show alongside the number. 

<tk:RadNumericUpDown  Width="150"  Height="50"
    Value="{Binding Exposure}"
    IsInteger="True"
    CustomUnit="ms"/>

It looks good but as soon as hit the + or - key, the 'ms' disappears and I have just a number.  This is because hitting +/- gives keyboard focus to the edit box -- activates the cursor in there and all that.    Once I click somewhere else focus leaves the edit box, the 'ms' re-appears.

Is there a property or some simple way that would let me prevent this behavior?   I want +/- to just change the number without grabbing the keyboard focus.  

Note that I do still want the number to be user-editable if they actually go to the trouble of clicking directly in the edit box itself.  I just want to stop +/- from doing that for me.
Joe
Top achievements
Rank 1
 asked on 08 May 2024
0 answers
23 views

Hi,

I am trying to change the theme through telerik StyleManager.Theme.

Not apply :

 <mynumeric:MyNumeric x:Name="TEST" Margin="-2,0,0,0"
                  Value="{Binding ViewModel.SerialNumber,Mode=TwoWay}" 
                   ValueFormat="Numeric"
                   NumberDecimalDigits="0"
                   Minimum="1" Maximum="9999"
                   telerik:StyleManager.Theme="{Binding Path=(mainwindowviewmodel:MainWindowViewModel.CurrentTheme),Converter={StaticResource ThemeToTelerikThemeConverter}}"
                   IsReadOnly="{Binding Path=(mainwindowviewmodel:MainWindowViewModel.IsManagerAccess),Converter={StaticResource InverseBooleanConverter}}"
                   >

Apply :

 <telerik:RadNumericUpDown x:Name="TEST" Margin="-2,0,0,0"
                  Value="{Binding ViewModel.SerialNumber,Mode=TwoWay}" 
                   ValueFormat="Numeric"
                   NumberDecimalDigits="0"
                   Minimum="1" Maximum="9999"
                   telerik:StyleManager.Theme="{Binding Path=(mainwindowviewmodel:MainWindowViewModel.CurrentTheme),Converter={StaticResource ThemeToTelerikThemeConverter}}"
                   IsReadOnly="{Binding Path=(mainwindowviewmodel:MainWindowViewModel.IsManagerAccess),Converter={StaticResource InverseBooleanConverter}}"
                   >

public class MyNumeric : RadNumericUpDown
{
    public override string FormatDisplay()
    {
        if (this.Value.HasValue)
        {
            return this.Value.Value.ToString("0000");
        }
        return base.FormatDisplay();
    }

    public override string FormatEdit()
    {
        if (this.Value.HasValue)
        {
            return this.Value.Value.ToString("0000");
        }
        return base.FormatEdit();
    }
}

internal class ThemeToTelerikThemeConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (!Enum.IsDefined(typeof(Wpf.Ui.Appearance.ThemeType), value))
            throw new ArgumentException("ExceptionEnumToBooleanConverterValueMustBeAnEnum");

        switch (value)
        {
            case Wpf.Ui.Appearance.ThemeType.Light:
                return "Office2019";
            case Wpf.Ui.Appearance.ThemeType.Dark:
                return "Expression_Dark";

            default:
                return "Office2019";
        }
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

I'll appreciate any help.

 

Dooly
Top achievements
Rank 1
Iron
 asked on 25 Mar 2024
2 answers
26 views

i am trying to custom style RadNumericUpDown control but every time i try to click right and edit control i am losing focus

tried to find the template in documentation to copy , paste and then edit, however i couldn't

can you help with this please?

 

Best

Wael
Top achievements
Rank 1
Iron
 answered on 27 Nov 2023
1 answer
42 views

Dear Telerik Team,

I am using the RadNumericUpDown control for accepting the numeric value. I have made hidden the up and down tick button so it look like simple textbox. The purpose of using this control specific for Distance and Weight values so it can be in any unit of measurement. For example, meter, millimeter, feet, kg, ton etc.

For simple UOM like meter, I can simply set the CustomUnit as "m" and it works fine. But How can I represent the value of 99.11 feet to feet and inch e.g., 99 ft 1 in

So whenever user trying to edit the value, it will be in feet only and once it is edited value will be displayed in feet and inch. 

How can  I achieve this behavior using RadNumericUpDown control ?

Thanks & Regards,

Hiren Lad

Dinko
Telerik team
 answered on 01 Nov 2023
1 answer
59 views

Hello,

I'm using several RadNumericUpDown controls and when the language/region is set to English, as expected they show numbers with dots as decimal separators, which is fine. But when I set any European language/region they still show dots rather than commas. How can I fix this issue?

My code is like the snippet below:

                                       <telerik:RadNumericUpDown Value="{Binding ScaleMin}" HorizontalAlignment="Stretch" Width="120" Margin="5"
                                                              VerticalAlignment="Center" SmallChange="0.1" ValueFormat="Numeric" IsEnabled="{Binding IsAvailable}">
                                        <telerik:RadNumericUpDown.NumberFormatInfo>
                                            <global:NumberFormatInfo NumberGroupSeparator="" NumberDecimalDigits="1"/>
                                        </telerik:RadNumericUpDown.NumberFormatInfo>
                                        <telerik:RadNumericUpDown.Resources>
                                            <Style TargetType="{x:Type TextBox}">
                                                <Setter Property="MaxLength" Value="8"/>
                                            </Style>
                                        </telerik:RadNumericUpDown.Resources>
                                    </telerik:RadNumericUpDown>

Thanks,

G.

Stenly
Telerik team
 answered on 20 Sep 2023
0 answers
119 views

Hello,

I have a NumericUpDown with the following configuration:

1. NumberDecimalDigits=3

2. Binding to Double property in ViewModel

3. Validation (IDataErrorInfo) between 20-3000.

4. Small change 0.001

5. Big change 0.1

When I write 123.1234, I can see 123.123 in the UI but in the view model, you don't remove the additional digits.

I have the following problems:

1. Sometimes when using arrows up/down or page up/down, the 4 digit is removed. I expected that the snall/large change takes effect without removing any digits because the NumberDecimalDigits shall affect the UI.

2. On grouping/filtering, I want to apply the logic on the UI value instead of the binding value.

For 1234.1234 and 1234.1235 will be created two different groups.

In case that I have a double with 4 digits, but in the UI is configured to N3, I don't want to see two groups with same value in the Header Text. The user will not understand why there are two groups.

How can I configure the RadNumericUpDown to show 3 digits but if there is an error and the number has 4 digits to show 4 digits? (with this solution the user will understand why there is an error if he types 19.9996.

For this value, it will be round 20.000 and mark as error when minimim value 20 is allowed. Showing 4 digits will solve it.

How can I configure the Grouping and Filtering of the RadGridView to consider some double value as N3?

alex
Top achievements
Rank 2
Bronze
Iron
Iron
 updated question on 16 Sep 2023
1 answer
32 views
I have a RadContextMenu (for an object on a canvas).  It works well. 
I added a NumericUpDown Control to it. 
When I open the menu, If I click the + or - button on the control first, it works fine.   
But if I click directly in the edit box of the control just after opening the menu, then the menu immediately closes.

If I open the menu, first click either the + or - and THEN click inside the edit control, then the menu stays open.

Is there a setting I can change to prevent the menu from immediately closing?

I have attached a small sample that illustrates the issue.  Run the app, right click on the shape and then immediately left click on the text-box portion of the Numeric Up Down.  The Menu will close.  But click on the +/- buttons first and it works.
Martin Ivanov
Telerik team
 answered on 11 Aug 2023
0 answers
46 views

I have tried to create two RadNumericUpDown controls, first one has a minimum value and second one has a maximum value. I thought that I can bind automatically minimum value as Minimum for second control, but here is the problem.

Problem is happens when Minimum value of RadNumericUpDown control was updated, but updated Value of second control was not bound to source.

<StackPanel>
        <telerik:RadNumericUpDown Value="{Binding MinValue, Mode=TwoWay}"/> //changes here are not updatind value of second control
        <telerik:RadNumericUpDown Value="{Binding MaxValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                                  Minimum="{Binding MinValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</StackPanel>

 

 

Kostiantyn
Top achievements
Rank 1
Iron
 asked on 01 Jun 2023
0 answers
84 views

Hello, I have an issue with the style of the ContextMenus.

I changed the style of the ContextMenu and it is working for TextBlock and TextBox but on Telerik controls like RadNumericUpDown and RadRichTextBox the context menu looks different.

Let's take for example the menu in the RadNumericUpDown (see attached picture).

I expect that the menu with Cut,Copy,Paste looks like other menus.

I tried to define in RadNumericUpDown.Resources a style for ContextMenu and RadContextMenu (change the Background property) but it doesn't work.

When I change the Foreground property of the TextBlock style inside RadNumericUpDown.Resources, I can see that the text color changed.

I hope you can guide me on this matter.

Thanks,

Alex

alex
Top achievements
Rank 2
Bronze
Iron
Iron
 updated question on 29 May 2023
1 answer
85 views

Hello. I am trying to add a simple Tooltip to the RadNumericUpDown control. On the style, the Tooltip content is set to RelativeSource Self, Path Value.

The problem is that my value is double and the tooltip is 3 decimal points. The RadNumericUpDown can be configured to use 1,2, or 3 decimal points but the Tooltip content is always 3 decimal points.

I tried to bind the content to the Display Text (the TextBlock inside the RadNumericUpDown) but I found that you are not raising property changed for this property. 

 

How can I update the property to show the decimal numbers as the dependency property of the RadNumericUpDown?

alex
Top achievements
Rank 2
Bronze
Iron
Iron
 updated answer on 13 Jan 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?