This project has moved and is read-only. For the latest updates, please go here.

IntegerUpDown (v1.7) - IsEditable?

Feb 28, 2013 at 8:02 PM
Edited Feb 28, 2013 at 9:06 PM
The all-too-brief documentation mentions the "IsEditable" property for the IntegerUpDown control. Was that added in 1.8 (or 1.9)?

Okay - I discovered that IsEditable is no longer a property in the UpDown classes. This change was made in v1.6, and the documentation still hasn't been updated.

So how do we restrict the user from typing in the text field (that doesn't ensure that the text is in fact a numeric value) and only using the spin buttons?
Mar 1, 2013 at 12:42 PM
I would do a derived class and access and override the IsReadOnly value to false.
in OnApplyTemplate, => TextBox.IsReadOnly = true;
Mar 1, 2013 at 12:44 PM
Thanks for your mention about the "IsEditable" reference in the docuementation. I have created a task to address this before the next version.
May 27, 2013 at 6:41 PM
Edited May 27, 2013 at 6:41 PM
Which task did you create for this issue? Would it be best to merge it with this one?

https://wpftoolkit.codeplex.com/workitem/19754

See also:

https://wpftoolkit.codeplex.com/discussions/444607
May 27, 2013 at 9:46 PM
The task was not created on the Issue but internally.
It has now been fixed.
Jun 4, 2014 at 8:56 AM
Hi,
another option that works for me, declare the event "PreviewTextInput" in the control style, and set handle = true in the event handler method:

<Style TargetType="{x:Type Extended:IntegerUpDown}" x:Key="IntegerUpDown_NotEditable">
<EventSetter Event="PreviewTextInput" Handler="IntegerUpDown_PreviewTextInput"/>
</Style>

In the code behind of the style class:

public partial class Style_Events : ResourceDictionary
{
protected void IntegerUpDown_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
    {
        if (sender is Xceed.Wpf.Toolkit.IntegerUpDown)
        {
            e.Handled = true;
        }
    }
}