Click here to Skip to main content
11,634,622 members (67,553 online)
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
JF201553.8K
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 OriginalGriff 8,736
1 Sergey Alexandrovich Kryukov 8,359
2 Mika Wendelius 6,845
3 F-ES Sitecore 2,354
4 Suvendu Shekhar Giri 2,205


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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100