Rashad Valliyengal
Rashad Valliyengal

Reputation: 3162

How to Block past date or selected dates in XamDateTimeInput

I have infragistics XamDateTimeInput control. I want to prevent users to select some configured dates or past dates(Disable the dates). Here is the example which i found in a train booking site. They disabled the past dates.

enter image description here

Thanks.

Upvotes: 0

Views: 836

Answers (1)

Physikbuddha
Physikbuddha

Reputation: 1662

I don't have the Infragistics control to test this, but from studying the XamDateTimeInput doc and the ValueConstraint doc, you should be able to set a min and max date by:

<XamDateTimeInput ...>
    <XamDateTimeInput.ValueConstraint>
        <ValueConstraint MinInclusive="Your min date" MaxInclusive="Your max date"/>
    </XamDateTimeInput.ValueConstraint>
</XamDateTimeInput>

I can't find a way to block a specific date range though. However, a few weeks ago I stumbled across this article on CodeProject, where the author has modified a regular WPF DatePicker. His solution also includes support for Blackout Dates:

CodeProject: A couple of tricks when using the standard WPF .NET 4.0 DatePicker control

You may use this post to modify your Infragistics XamDateTimeInput control. I can't test or provide an example here, as like I said, I haven't purchased their controls.

Upvotes: 1

Related Questions