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
1255
using Binding on ValueConstraint properties
posted

I am trying to build a date range control with two XamDateTimeEditors.

I want to use ValueConstraint on each editor to restrict the value of the “From” date based on the user’s input “To” date and vice versa.

In the snippet below, the explicit setting of the MinInclusive on the “From” works as expected, but the Constraints that use binding do not seem to be working.  I do not see any binding errors in VS output.  Is it possible to use binding on ValueConstraint properties?  If not, do I have to handle this in code behind OnEditModeEnding?

Also, I set the ValidateAsType to DateTime, will my explicit setting of MinInclusive fail if the culture does not match how I input the value?

<igEditors:XamDateTimeEditor Grid.Column="2"

x:Name="dtFromDate"

Value="{Binding Path=SelectedFromDate, ElementName=SPSUserControlBase, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"

Text="{Binding Path=SelectedFromDateString, ElementName=SPSUserControlBase, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">

<igEditors:XamDateTimeEditor.ValueConstraint>

<igEditors:ValueConstraint ValidateAsType="DateTime"

MinInclusive="1/1/1753"

MaxInclusive="{Binding Path=Value, ElementName=dtToDate, Mode=OneWay}" />

</igEditors:XamDateTimeEditor.ValueConstraint>

</igEditors:XamDateTimeEditor >

<igEditors:XamDateTimeEditor Value="{Binding Path=SelectedToDate, ElementName=SPSUserControlBase, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"

Text="{Binding Path=SelectedToDateString, ElementName=SPSUserControlBase, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"

Grid.Column="5"

x:Name="dtToDate" >

< igEditors:XamDateTimeEditor.ValueConstraint>

<igEditors:XamDateTimeEditor MinInclusive="{Binding Path=Value, ElementName=dtFromDate, Mode=OneWay}" />

</local: igEditors:XamDateTimeEditor.ValueConstraint>

</igEditors:XamDateTimeEditor >