title: WPF DatePicker, display todays date with binding to property
body: <p><em>This is a possible duplicate of <a href="https://stackoverflow.com/questions/3662506/set-the-default-date-of-wpf-date-picker-to-current-date">Set the Default Date of WPF Date Picker to Current Date</a> but I have tried the code from the question and it doesn't work, hopefully I am missing something simple</em> </p>
  
  <p>OK as the question states, I want to display the current date when the view loads, however, I have the SelectedDate property bounded to a property of mine, and I dont think you can use "Text" because the property that I am binding to is a DateTime property. yes, I could do a convert in the model but XAML (I think) should be able to do this for me.</p>
  
  <p>OK I know what is the problem, the date is coming out "01/01/0001" because of course, its binding to my property which is defaulted to 01/01/0001, so I guess I will need to do some C# code in my property to say if its 01/01/0001, use DateTime.Now and if not, use the property.   </p>
  
  <p>The XAML</p>
  
  <pre><code>    &lt;DatePicker HorizontalAlignment="Left" 
                  DisplayDate="{x:Static System:DateTime.Now}"
                  SelectedDate="{Binding AvailableFrom, Mode=TwoWay}"
                  Margin="139,58,0,0" 
                  VerticalAlignment="Top" 
                  Width="120"/&gt; 
  </code></pre>
  
  <p>Am happy to delete this after if the big reps think it is a duplicate, </p>
  
  <p>What I did to resolve...</p>
  
  <pre><code>     get
       {
  
           if (m_AvailableFrom == DateTime.MinValue)
               return DateTime.Now;
  
          return m_AvailableFrom;
       }
  </code></pre>
  
  <p>Cheers for the help</p>