Derives from Xceed.Wpf.Toolkit.AutoSelectTextBox

Represents a control that limits the value extracted from the inputted text to be within the bounds determined by the MinValue and MaxValue properties.


Property Description
BeepOnError Gets or sets a value indicating if a system beep is raised when an inputted character is rejected.
FormatProvider Gets or sets the IFormatProvider that will be used to perform type validation.
HasParsingError Gets a value indicating that an error occurred while parsing the inputted text.
HasValidationError Gets a value indicating whether an error occurred during the validation of the Value.
IsValueOutOfRange Gets a value indicating if the value is out of range.
MaxValue Gets or sets the maximum accepted value.
MinValue Gets or sets the minimum accepted value.
NullValue Gets or sets a value representing the control's null value.
Value Gets or sets the control's value.
ValueDataType Gets or sets the type of the control's Value.


Event Description
QueryTextFromValue Raised when a value is being queried to return its string representation.
QueryValueFromText Raised when inputted text is queried to return its corresponding value.

Support this project, check out the Plus Edition.

Last edited Jun 1, 2016 at 2:53 PM by dlafontaine, version 2


BoucherS Nov 25, 2016 at 2:13 PM 
It works when doing this :
<xctk:ValueRangeTextBox Text="AA">
<Trigger Property="xctk:ValueRangeTextBox.HasValidationError"

SezMe Nov 23, 2016 at 12:54 AM 
I am setting a Style for a ValueRangeTextBox as follows:

Property="xctk:ValueRangeTextBox.HasValidationError" Value="True">
<Setter Property="BorderBrush" Value="Red" />
<Setter Property="BorderThickness" Value="2" />

but then I get this error at design time:
'{DependencyProperty.UnsetValue}' is not a valid value for property 'HasValidationError'.


SezMe May 14, 2016 at 2:17 AM 
Yes, of course, I should be binding value, not text. Thanks for the sharp eye.

BoucherS May 13, 2016 at 6:08 PM 

My first thought from reading the code is that you are binding the "Mileage" property to ValueRangeTextBox.Text where this Text property is a string. So, the "value" received from the Validate method will always be a string.
In the LostFocus callback, you check the ValueRangeTextBox.Value property, which can be a Int64.

SezMe May 13, 2016 at 9:30 AM 
I have a ValueRangeTextBox defined as follows:

ValueDataType="{x:Type s:Int64}">
<local:MinMileage />

The class MinMMileage is defined as:

Public Class MinMileage
Inherits ValidationRule

Public Overrides Function Validate(value As Object, cultureInfo As CultureInfo) As ValidationResult
Debug.WriteLine(TypeOf value Is String)
<other code>
End Function
End Class

I also have
Private Sub txtMileage_LostFocus(sender As Object, e As RoutedEventArgs) Handles txtMileage.LostFocus
Debug.WriteLine(TypeOf txtMileage.Value Is Int64)
End Sub

The Lost_Focus event occurs before the validation. The Debug statement gives True, as it should. However, the next statement executed is the Validate Function and that Debug statement also gives True, which means that the value passed to the validation function has been changed from an Int64 to a string.

Am I doing something wrong or is this a bug?

SezMe Mar 14, 2016 at 2:52 AM 
For the ValueRangeTextBox I have BeepOnError = True and ValueDataType="{x:Type s:Single}"

When I enter an alphanumeric into there is no beep. What are the conditions that will trigger the beep?

BoucherS Mar 8, 2016 at 1:48 PM 
"s" namespace can be define like this :

SezMe Mar 8, 2016 at 12:15 AM 
Good examples but how is the namespace "s" defined? (Sorry to be a bug - I've just started using the Toolkit)

BoucherS Mar 7, 2016 at 12:39 PM 
here are examples :
<xctk:ValueRangeTextBox MinValue="10" MaxValue="20" ValueDataType="{x:Type s:Int32}"/>
<xctk:ValueRangeTextBox MinValue="0" MaxValue="10" ValueDataType="{x:Type s:Double}"/>
<xctk:ValueRangeTextBox MinValue="0" MaxValue="10" ValueDataType="{x:Type s:String}"/>

SezMe Mar 7, 2016 at 6:31 AM 
What are valid ValueDataTypes? I cannot set anything (string, Int32, etc.) in XAML or code)

fedemonte89 Apr 8, 2015 at 3:59 PM 
I'm sorry, my problem is caused by the Value defined as "string". So during ValueRangeTextBox initialization the Exception is thrown.

fedemonte89 Apr 8, 2015 at 3:26 PM 
Is it possible to bind ValueDataType to any attribute of an object?
Now I'm trying to do something like this:
<xctk:ValueRangeTextBox ValueDataType="{Binding PrimitiveType, Mode=OneWay}" />

but an Exception is thrown. Is there any solution?

Thank you for all your work!! :)