Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: WPF C#4.0
hai to all ,
i have to put validation on EstimationStartDate and EstimatedCompletionFields...
 
I Tried like this.
 
       private DateTime _estimatedStartDate;
       [DataMember]
       public DateTime EstimatedStartDate
       {
           get { return _estimatedStartDate; }
           set
           {
               if (value == _estimatedStartDate)
                   return;
 
               _estimatedStartDate = value;
               NotifyPropertyChange(EstimatedStartDate);
           }
 
       }
 
       private DateTime _estimatedCompletionDate;
       [PropertyComparisonValidator(EstimatedStartDate", ComparisonOperator.GreaterThanEqual , MessageTemplate = Estimated Completion Date should be Greater than or equal to the Estimated Start Date)]
       [DataMember]
       public DateTime EstimatedCompletionDate
       {
           get{ return _estimatedCompletionDate; }
           set
           {
               if (value == _estimatedCompletionDate)
                   return;
 
               _estimatedCompletionDate = value;
               NotifyPropertyChange("EstimatedCompletionDate");
           }
 
       }
 
This is working fine when i changed the dates ...
 
Those are the ComboBox Fields...
 
when i changed the ExstimationCompletionDate combobox field ...I am getting default time as 12:00:00 A.M for the fields ...so I was not able to save...
I try to changed EstimatedComplitionData combobox then I get that time...
 
please help me ...
Posted 28-Oct-10 1:27am
Edited 28-Oct-10 1:28am
JF201553K
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Unless you actually have an estimated start/end time, you should both change your properties to the following:
 

public DateTime WhicheverDate
{
    get{ return _backingField.Date; }
    set
    {
        if (value.Date == _backingField.date)
            return;
        _backingField. = value.Date;
        NotifyPropertyChange("WhicheverDate");
    }
}
 
This removes the ambiguity around the time. If you need to keep the time, obviouly this is not a solution.
  Permalink  
Comments
satyagrahi_2010 at 29-Oct-10 0:51am
   
Nice Answer Help me...
Thanks Barrow...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 350
1 OriginalGriff 283
2 Nguyen.H.H.Dang 230
3 Sergey Alexandrovich Kryukov 230
4 Peter Leow 195


Advertise | Privacy | Mobile
Web01 | 2.8.140709.1 | Last Updated 28 Oct 2010
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid