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
1415
XamDateTimeInput restricted dates
posted

Using XamDateTimeInput, I would like to bind a list of valid dates which can be selected.  Any date not in the list binded to the control would be disabled from the user selection.

How can I achieve this?

Parents Reply
  • 7555
    Verified Answer
    Offline posted in reply to PMac 007

    Hello ,

    This error message is coming through InvalidValueBehavior property. The default value of the xamInputs’ InvalidValueBehavior property is DisplayErrorMessage. You can change it to any other enum value(may be ‘ReverValue’), you can set it like this:

    <ig:XamDateTimeInput Grid.Column="1" Value="{Binding Date, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}"          
                SpinIncrement="1d" Height="35" InvalidValueBehavior="RevertValue">
                <ig:XamDateTimeInput.ValueConstraint>
                    <ig:ValueConstraint Enumeration="{Binding DateList}" />
                </ig:XamDateTimeInput.ValueConstraint>
            </ig:XamDateTimeInput>
    

    or another option to restrict the calendar dates are to set DisabledDates of the XamCalendar of the XamDateTimeInput’s containing a particular range. I attached a sample here for your reference.

    Let me know if you have any question.

    Regards,

    Divya

    0640.WpfApplication1.zip

Children
No Data