title: How to clear DatePicker value in WPF 4.0 using MVVM
body: <h2>Model</h2>
  
  <pre><code>public class SearchParametersModel : ViewModelBase
  {
     private string _fromDate;
  
     public string FromDate
     {
         get { return _fromDate; }
         set
         {
             _fromDate = value;
             VerifyPropertyName("FromDate");
         }
     }
  
     private string _toDate;
  
     public string ToDate
     {
         get { return _toDate; }
         set
         {
             _toDate = value;
             VerifyPropertyName("ToDate");
         }
     }
  
     private DateTime? _selectedFromdate;
  
     public DateTime? SelectedFromDate
     {
         get { return _selectedFromdate; }
         set
         {
             _selectedFromdate = value;
             VerifyPropertyName("SelectedFromDate");
         }
     }
  
     private DateTime? _selectedTodate;
  
     public DateTime? SelectedToDate
     {
         get { return _selectedTodate; }
         set
         {
             _selectedTodate = value;
             VerifyPropertyName("SelectedToDate");
         }
     }
  }
  </code></pre>
  
  <hr>
  
  <h2>ViewModel</h2>
  
  <pre><code>private void Clear()
     {
         try
         {
             SearchParametersMdl.ToDate = string.Empty;
  
             SearchParametersMdl.FromDate = string.Empty;
  
             SearchParametersMdl.SelectedFromDate = null;
  
             SearchParametersMdl.SelectedToDate = null;
  
         }
         catch (Exception ex)
         {
  
             throw ex;
         }
     }
  </code></pre>
  
  <hr>
  
  <h2>View</h2>
  
  <pre><code>&lt;DatePicker Height="25" HorizontalAlignment="Left" Margin="84,71,0,0"
  Name="dtpFromDate" VerticalAlignment="Top" Width="115" Text="{Binding Path=
  SearchParametersMdl.FromDate,Mode=TwoWay}" SelectedDate="{Binding
  Path=SearchParametersMdl.SelectedFromDate,Mode=TwoWay}"  /&gt;
  
  &lt;DatePicker Height="25" HorizontalAlignment="Right" Margin="0,70,481,0"
  Name="dtpToDate"  VerticalAlignment="Top" Width="115" Text="{Binding Path=
  SearchParametersMdl.ToDate,Mode=TwoWay}" SelectedDate="{Binding
  Path=SearchParametersMdl.SelectedToDate ,Mode=TwoWay}" /&gt;
  </code></pre>
  
  <hr>
  
  <p>Unable to clear the values in datepicker control.</p>
  
  <p>I want to display default value(i.e. Select a date) after firing clear cammand.</p>