I've set SpinWrap=False in a XamNumericEditor but when I hit key up or key down, the value increments or decrements respectively.
How can I disable the increment/decrement function for a XamNumericEditor? I want the XamNumericEditor does not change its value when the user presses key up/down.
Thank you very much
SpinWrap has to do with whether the value will spin from the max to the min when spinning up or from the min to the max when spinning down. It is not a means of preventing spinning. Currently there is no property to disable spinning - essentially certain types of masked sections support spinning. If you want to disable the spinning you will need to handle the ExecutingCommand event and cancel it if the SpinUp|Down command is being processed. e.g.
Andrew,
Thank you for your explanation. One more question. Is there any way to disable spinning without having to code these lines for every XamNumericEditor I use in my application?
Oscar.
Oscar,
You can use the EventManager.RegisterClassHandler method to register ExecutingCommand event for all the XamNumericEditors in your application.
Hope this helps.
Hello Andy,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Hello,
Thank you for your response. It worked fine. I found one more way to do this --> Setters.Add(new Setter(XamNumericEditor.SpinIncrementProperty, false)
This solves my issue. Thank you so much for your time and help.
I have modified the sample I sent you before following your scenario and everything seems to work ok on my side. If the sample doesn’t satisfies all your needs feel free to modify it, so it reproduces your behavior and send it back to me for further investigation.
Looking forward for your reply.
Hi,
Thank you so much for your response.
I saw your code and It works perfect the way you wrote.
But, this doesn't work for the unbound fields which we generate dynamically in xamDataGrid.
I've xamDataGrid with dynamically generated fields with Edit mode as xamNumericEditor. Here I can't turnoff the spinUP and spin Down. Your help in this will be really helpful.
Thanks again for your help.
Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Basically I created Style for the XamNumericEditor, where I handled the Loaded event and in its handler I handled the ExecutingCommand event. Please let me know if this helps you or you need further assistance on this matter.