This is a migrated thread and some comments may be shown as answers.

Hooking into ValueChange

1 Answer 195 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Isaac
Top achievements
Rank 1
Isaac asked on 09 Mar 2020, 07:43 PM

I am trying to validate a Textbox that will hold an IP Address. I have a working example that works as expected

 

 <telerik:RadMaskedTextInput ValidationRegex="{x:Static maskedInput:ValidationHelper.IP}" x:Name="hueIpAddress" Height="23" Margin="203,39,0,0" VerticalAlignment="Top" Width="120" HorizontalAlignment="Left" 
                                    EmptyContent="Enter IP Address"
                                    InputBehavior="Insert"                 
                                    Mask="{Binding Path=Text, ElementName=Mask, Mode=TwoWay}"
                                    IsClearButtonVisible="False"
                                    SelectionOnFocus="CaretToEnd"
                                    TextMode="PlainText" 
                                    UpdateValueEvent="ProperyChanged"     />

 

But no matter what I do, I cannot get an event to fire when the value is updated. I have tried ValueChanged and ValueChanging, but none fire as expected, and I am not interested in playing the PreviewTextInput/KeyDown game which is unreliable. I want to be able to update a label on my page with the current value of the text box, and doing it via the handle method as I will need to do other stuff as well. 

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 12 Mar 2020, 10:54 AM

Hi Isaac,

Thank you for the provided code snippet.

When the Mask property is set, the Value property of the control will be changed only when all required symbols inside the mask are set. Otherwise, the ValueChanged event won't be triggered. To allow property change on every user input, you can set the AllowInvalidValues property to True. 

Give this property a try, and let me know if it works for you.

Regards,
Dinko
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Isaac
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or