Hooking into ValueChange

2 posts, 0 answers
  1. Isaac
    Isaac avatar
    1 posts
    Member since:
    Sep 2019

    Posted 09 Mar Link to this post

    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. 

  2. Dinko
    Admin
    Dinko avatar
    1123 posts

    Posted 12 Mar Link to this post

    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.
Back to Top