This is a migrated thread and some comments may be shown as answers.

Unable to set the currency symbol and decimal places for radspinEditor

5 Answers 48 Views
SpinEditor
This is a migrated thread and some comments may be shown as answers.
Marco
Top achievements
Rank 1
Marco asked on 22 Oct 2018, 10:42 AM

Hello,

I'm unable to set the $ currency symbol as well as decimal places for radspinEditor, Please check image and do the needful.

5 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 23 Oct 2018, 07:32 AM
Hello Marco,

The control exposes a DecimalPlaces property and you can set it. Regarding the currency symbol, you can follow the approach suggested in the following KB article and create a custom control: https://docs.telerik.com/devtools/winforms/knowledge-base/scientific-notation-leading-zeros-spineditor.

I hope this helps. Let me know if you need further assistance.

Regards,
Hristo
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Marco
Top achievements
Rank 1
answered on 31 Oct 2018, 06:25 AM

Hello Hristo,

Thank you for the suggested 

I've fixed the decimal place & its working fine. 
I'm unable to bring the currency symbol into the Radspineditor, can you suggest me another method for it.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 31 Oct 2018, 11:57 AM
Hello, Marco, 

I would recommend you to consider using a RadMaskedEditBox with currency mask. Thus, the currency symbol will be displayed before the actual text value. The following help article are quite useful for getting started experience: 
https://docs.telerik.com/devtools/winforms/editors/maskededitbox/working-with-radmaskededitbox
https://docs.telerik.com/devtools/winforms/editors/maskededitbox/numeric-masks

As to the case with RadSpinEditor and showing a currency symbol, the previously referred article demonstrates a sample approach how to create a custom RadSpinEditor. You can add a separate element for displaying the currency symbol. You can find below a sample code snippet which result is illustrated in the below screenshot:



public class MyRadSpinEditor : RadSpinEditor
{
    private MyRadSpinElement spinElement;
 
    public override string ThemeClassName
    {
        get
        {
            return typeof(RadSpinEditor).FullName;
        }
    }
 
    protected override RadSpinElement CreateSpinElement()
    {
        this.spinElement = new MyRadSpinElement();
        return this.spinElement;
    }
}
 
public class MyRadSpinElement : RadSpinElement
{
    LightVisualElement currencySymbol = new LightVisualElement();
 
    protected override void CreateChildElements()
    {
        base.CreateChildElements();
        currencySymbol.Text = "$";
        currencySymbol.StretchHorizontally = false;
        StackLayoutElement layout = this.Children.Last() as StackLayoutElement;
        layout.Children.Insert(0, currencySymbol);
    }
 
    protected override Type ThemeEffectiveType
    {
        get
        {
            return typeof(RadSpinElement);
        }
    }
}

I hope this information helps.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Marco
Top achievements
Rank 1
answered on 12 Nov 2018, 12:38 PM

Hello, Dess 

Does the above code 2018.1.116.40 version?

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 13 Nov 2018, 11:09 AM
Hello, Marco, 

I have tested the provided custom code with the specified version 2018.1.116 and it seems to work as expected. 

Feel free to use it with this version as well.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
SpinEditor
Asked by
Marco
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Marco
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or