10

How to bind the Selected DateTime in WPF Toolkit's or extended Toolkit's DateTimePicker as I do not find a SelectedDateTime property?

I guesses I might need to bind it with the 'Value' property but I am not sure. No documentation is available.

I am using MVVM.

Shakti Prakash Singh
  • 2,414
  • 5
  • 35
  • 59
  • 1
    This question really helped me - I'd been binding to the Text property and was getting some strange date format conversion problems! – Robin Bennett Oct 05 '18 at 14:09

1 Answers1

20

For DatePicker it's SelectedDate property, and for DateTimePicker it's Value since there's no other property with type DateTime.

<DatePicker SelectedDate="{Binding MyDate}" />

<xctk:DateTimePicker Value="{Binding MyDate}"></xctk:DateTimePicker>

And if you are using .Net 4, there's already a build-in DatePicker, so no need for the Toolkit, there isn't a DateTimePicker though.

shriek
  • 5,157
  • 2
  • 36
  • 42
  • I had been using WPF DatePicker only, but my requirement is DateTimePicker. I tried binding with Value property and it binds successfully. I figured it out though. But thanks for reassurance. :) – Shakti Prakash Singh May 17 '12 at 11:42
  • 1
    I wish the full DateTimePicker would be integrated. I'm using the xceed extension only for this. – flux Sep 09 '15 at 08:52