Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
196
Need to Control XamTextEditor tab navigation on custom error validation.
posted

 
Hi everyone

I have a wpf window having 4 XamTextEditor controls.

for that i have set the TabIndex as (0,1,2,3) and can do tab navigation.

Now the requirement is

i have a validation on the XamTextEditor4 (on the EditModeEnded event  of the control i am doing a validation if value is not correct in the XamTextEditor i display a messagebox showing the error)

Now the problem is if the value is wrong an errorMessagebox is displayed .But if i click yes on the messagebox Button the tab is navigationg to the next control.(for my case to the next window.)

I need to control this behaviour .That means if validation fails i need to stop the tab navigation and bring the focus to the same XamTextEditor4 .

please suggest a solution

Note: I have used textBox.MoveFocus to previous and textbox.focus() etc.None works

Thanks
SNA

Parents
No Data
Reply
  • 54937
    Offline posted

    Perhaps you should handle the EditModeEnding event instead and cancel exiting edit mode? Another alternative would be to try and use the ValueConstraint to validate your data. Aside from the various properties it exposes (MinLength, RegEx, MinInclusive, etc.), in 9.2 it also exposes a ValidationRules property so you could provide custom ValidationRule instances that will be evaluated when the value needs to be validated.

Children