Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1960
Obtain the formatted text from an UltraNumericEditor
posted

Hello,

I have an UltraNumericEditor set to NumericType = Double and an MaskInput = "{double:2.2} mm"

If I set the Value to 1.123 the control will format the text in accordance to the MaskInput and will display "1.12 mm". Is there a way to obtain the masked text programatically? In this scenario I would get "1.12 mm".

Thanks.

Parents
No Data
Reply
  • 69832
    Verified Answer
    Offline posted

    The EditorWithMask embeddable editor (which the UltraNumericEditor uses) exposes a 'GetText' method which takes a valeu that allows you to specify whether you want the raw text, text with literals, text with prompt characters, etc. The caviat is that you can only use it when the control is in edit mode, i.e., when it has focus. You can force the control to always be in edit mode by setting its AlwaysInEditMode property to true if you want.

    Example:
    if ( this.ultraNumericEditor1.IsInEditMode )
    {
        EditorWithMask editor = this.ultraNumericEditor1.Editor as EditorWithMask;
        string textWithLiteralsAndPrompts = editor.GetText(Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeBoth );
    }

Children