I have a ValueRangeTextBox defined as follows:
<xctk:ValueRangeTextBox
Name="txtMileage"
ValueDataType="{x:Type s:Int64}">
<xctk:ValueRangeTextBox.Text>
<Binding
Path="Mileage"
Mode="TwoWay">
<Binding.ValidationRules>
<local:MinMileage />
</Binding.ValidationRules>
</Binding>
</xctk:ValueRangeTextBox.Text>
</xctk:ValueRangeTextBox>
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?
↧