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
805
xamMaskEditor
posted

 

 Thanks for your reply.

XamMaskedEditor or XamNumericEditor could be my solution. I have tried to use both, but I am not able to achieve required functionality. My requirement is that user is not allowed to edit the integer portion of a number that is displayed in the XamNumericEditor. For example, if the number displayed in the XamNumericEditor is 10109.0000, user is not allowed to change 10109 but he can change the decimal portion .0000. So, for this case, I'm using masking property of XamNumericEditor as "10109.nnnn" . I have used following code for assigning the style of a field of XamDataGrid:

FieldSettings fieldSettings = new FieldSettings();
Style style = new Style(typeof(XamNumericEditor));
Setter setter = new Setter(XamNumericEditor.MaskProperty, "10109.nnnn");
style.Setters.Add(setter);
fieldSettings.EditorStyle = style;
/* Set this fieldSettings to the required field of XamDataGrid. */

However, I'm getting unexpected result on the editor. Instead of getting 10109.____ on the editor, I'm getting 1010_.____.

But, if I use "10108.nnnn" or other numbers other than 9 in the end, I'm getting expected results such as 10108.____.

Why setting the XamNumericEditor.MaskProperty is also changing the Text of the editor? Why is there discrepancy in 9 ?

Parents
No Data
Reply
  • 54937
    Offline posted

    balajirajendran said:
    Why setting the XamNumericEditor.MaskProperty is also changing the Text of the editor?

    I'm not sure I follow. The mask is used to determine the value and the text. Note you can set the DataMode to something like Raw to have it not include the literals in the text.

    balajirajendran said:
    Why is there discrepancy in 9 ?

    9 is a valid mask character which is why it is being interpretted as an input character. You would need to escape that character (i.e. prefix it with a \).

Children
No Data