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.
This is because you and I cannot seem to find the appropriate EventHandler. One way to avoid this is to create a style for the XamNumericEditor like this:
<Style TargetType="{x:Type igEditors:XamNumericEditor}">
<EventSetter Handler="x_ExecutingCommand" Event="ExecutingCommand"/>
</Style>
...
void x_ExecutingCommand(object sender, Infragistics.Windows.Controls.Events.ExecutingCommandEventArgs e)
{
if (e.Command == MaskedEditorCommands.SpinUp || e.Command == MaskedEditorCommands.SpinDown)
e.Cancel = true;
}
Without setting key, it will apply to all of the NumericEditors.
Hope this helps.
This doesn't work for Dynamically generated xamNumericEditors. Is there any other way to fix the SpinUp and SpinDown to TurnOff.
Hello,
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.
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.
Hello Andy,
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.
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.
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.