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
195
Date Validation using XamDateTimeEditor
posted

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

Parents
  • 9694
    posted

    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,

Reply Children