title: Override a method call so it is not called under specific situations
body: <p>I apologize for the weird topic wording.</p>
  
  <p>I have two Date pickers, a Duration textbox only accepting numeric values, and two methods for the SelectedDateChanged along with the Text_TextChanged.</p>
  
  <p>What I am trying to do is what MS Project does with their Start Date/End Date/Duration (if anyone has any knowledge with it) But basically, a user can enter 2 of the 3 and it will populate the the other one accordingly. So if I enter 3 in textbox (days) and I choose 12/10/2013 in my End Date <code>DatePicker</code> my 2 objects should say startdate - <code>12/10/2013</code> End Date - <code>12/13/2013</code> text 3</p>
  
  <p>Here is my code behind for the 2 datePicker Methods.</p>
  
  <pre><code>    private void DatePickerEndDate1_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
      {
          if(!String.IsNullOrWhiteSpace(DatePickerEndDate1.ToString()))
              newEndDate = DateTime.Parse(DatePickerEndDate1.ToString());
          if (!String.IsNullOrWhiteSpace(DatePickerEndDate1.ToString()) &amp;&amp; !String.IsNullOrWhiteSpace(DatePickerStartDate1.ToString()))
          {
              if (DatePickerEndDate1.SelectedDate &lt; DatePickerStartDate1.SelectedDate)
              {
                  DatePickerStartDate1.SelectedDate = DatePickerEndDate1.SelectedDate;
                  DatePickerEndDate1.SelectedDate = originalStartDate;
              }
  
              TimeSpan differenceBetweenStartandEndDate = newEndDate.Subtract(newStartDate);
              TextDuration.Text = differenceBetweenStartandEndDate.Days.ToString();
          }
          else if (DatePickerEndDate1.SelectedDate != null &amp;&amp; DatePickerStartDate1.SelectedDate == null)
          {
              DatePickerStartDate1.SelectedDate = newEndDate;
              DatePickerEndDate1.SelectedDate = newEndDate.AddDays(taskLength);
          }
      }
  
      private void DatePickerStartDate1_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
      {
          if(!String.IsNullOrWhiteSpace(DatePickerStartDate1.ToString()))
              newStartDate = DateTime.Parse(DatePickerStartDate1.ToString());
          if (!String.IsNullOrWhiteSpace(DatePickerEndDate1.ToString()) &amp;&amp; !String.IsNullOrWhiteSpace(DatePickerStartDate1.ToString()))
          {
              if (DatePickerStartDate1.SelectedDate &gt; DatePickerEndDate1.SelectedDate)
              {
                  DatePickerEndDate1.SelectedDate = DatePickerStartDate1.SelectedDate;
                  DatePickerStartDate1.SelectedDate = originalEndDate;
              }
  
  
              TimeSpan differenceBetweenStartandEndDate = newEndDate.Subtract(newStartDate);
              TextDuration.Text = differenceBetweenStartandEndDate.Days.ToString();
          }
          else if (DatePickerStartDate1.SelectedDate != null &amp;&amp; DatePickerEndDate1.SelectedDate == null)
          {
              DatePickerEndDate1.SelectedDate = newEndDate;
              DatePickerStartDate1.SelectedDate = newEndDate.AddDays(taskLength);
          }
  
      }
  </code></pre>
  
  <p>I was debugging and realized my error came when I was resetting say DatePickerStartDate1 (for this instance)in the Else if method. And this would ReFire my DatePickerEndDate1 since it was being changed which would also call my TextDuration_TextChanged.</p>
  
  <pre><code>    private void TextDuration_TextChanged(object sender, TextChangedEventArgs e)
      {
          if(int.TryParse(TextDuration.Text, out taskLength))
  
          if (DatePickerStartDate1.SelectedDate != null)
          {
              DatePickerEndDate1.SelectedDate = newStartDate.AddDays(taskLength);
          }
          else if (DatePickerEndDate1.SelectedDate != null)
          {
              DatePickerStartDate1.SelectedDate = newEndDate.AddDays(taskLength);
          }
      }
  </code></pre>
  
  <p>which is firing that, it would reset my taskLength back to 0 and ultimately setting all the dates to <code>12/10/2013</code> since it never added the 3 days.  </p>
  
  <p>Now I was wondering if I could write a line of code that would NOT call that method if and only if I was in that else if?</p>