Hi,
I need to basically ensure that the user does not select a date less than todays date. I tried to use the value constraint as below. I did not get this working since I try to attach a custom object as a value for the "MinInclusive" field.
If I give a hard coded date it validates correctly. Can anyone suggest how to bind my custom object to the MinInclusive field? Im using MVVM pattern
<igDP:Field Name="AuditScheduledDate">
<igDP:Field.Settings>
<igDP:FieldSettings EditorType="{x:Type igEdit:XamDateTimeEditor}" EditAsType="{x:Type Sys:DateTime}">
<igDP:FieldSettings.EditorStyle>
<Style TargetType="{x:Type igEdit:ValueEditor}">
<Style.Setters>
<Setter Property="ValueConstraint">
<Setter.Value>
<igEdit:ValueConstraint MinInclusive="{Binding Path=MinDate, Mode=TwoWay}" MaxInclusive="01/01/2050" />
</Setter.Value>
</Setter>
<Setter Property="InvalidValueBehavior" Value="RetainValue" />
</Style.Setters>
<Style.Triggers>
<Trigger Property="IsValueValid" Value="false">
<Trigger.Setters>
<Setter Property="BorderBrush" Value="Red" />
</Trigger.Setters>
</Trigger>
</Style.Triggers>
</Style>
</igDP:FieldSettings.EditorStyle>
</igDP:FieldSettings>
</igDP:Field.Settings>
</igDP:Field>
Thanks,
Ranjith
Hello,
I apologize that this post was not answered sooner. We are making the effort to ensure all posts are addressed by an Infragistics expert. I was wondering if you still need our assistance in this matter.
Looking at your XAML, the binding expression used in MinInclusive looks correct. The problem may be in what the object is that is being bound. Would you provide more information about the type of data being used here?
Thank you,
Hi Curtis,
I'm facing the same problem:
<
igDP:Field Name="fromDate" Label="Date">
<!--Binding="{Binding fromDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">-->
<igDP:FieldSettings EditAsType="{x:Type sys:DateTime}">
<Style TargetType="{x:Type igEditors:XamDateTimeEditor}">
<Setter Property="Mask" Value="{}{date}" />
<Setter Property="InvalidValueBehavior" Value="DisplayErrorMessage" />
<igEditors:ValueConstraint MaxInclusive="{Binding Path=maxFromDate,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<igEditors:ValueConstraint.Nullable>
<sys:Boolean>False</sys:Boolean>
</igEditors:ValueConstraint.Nullable>
<igEditors:ValueConstraint.MinInclusive>
<sys:DateTime>01/01/1900</sys:DateTime>
</igEditors:ValueConstraint.MinInclusive>
</igEditors:ValueConstraint>
My property maxFromDate in the view model is of a DateTime type. The values for max date is not bound at all!!!
Please help!