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
235
InValid Value focus issue
posted

In XamDateTimeInput, I am having the following validation,

<ig:XamDateTimeInput.ValueConstraint>
<ig:ValueConstraint MaxInclusive="{Binding Source={x:Static System:DateTime.Now}}" Nullable="False" />
</ig:XamDateTimeInput.ValueConstraint>

On Clearing the value in the control - making date as null and tabing out. A validation message box is displayed - "Value cannot be null" . But the focus is going to the next control. 

If the value in the DateTimeINput control is invalid, Can't we make the focus not to move out of the control, until the user enters a valid value?

Parents
No Data
Reply
  • 16495
    Offline posted

    Hello ,

     

    Thank you for your post.

     

    I have been looking into it  and what I can suggest is to take a look at the following forum thread where you can see how to set focus to control:

     

     http://es.infragistics.com/community/forums/t/90213.aspx

     

    Basically you can handle ValidationError event of XamDateTimeInput and in the event handler you can use Focus method of Keyboard. The following code snipped illustrate this:

     

    private void input_ValidationError(object sender, EditModeValidationErrorEventArgs e)

            {

                if ((sender as XamDateTimeInput).Value == null)

                {

                    Keyboard.Focus(XamDateTimeInputName);

                }

            }

     

    Please let me know if you need any further assistance on the matter.

Children