DatePicker help - binding to database

Jul 7, 2009 at 10:01 AM
Edited Jul 7, 2009 at 10:09 AM

I sort of new to WPF and i could use some help! i have a database that has a column type datetime. i would like to some how bind that column to the datepicker and mark da dates in the calendar. Is it possible?

Thanks in advance


Jul 20, 2009 at 11:17 PM

Hi Simonjanevski -

The SelectedDates property cannot be bound to like the SelectedDate property. You'll have to work with the collection manually and call AddRange(DateTime, DateTime) on the SelectedDates once you've got your DateTime objects representing the dates you're pulling from your database.


-Eric, MSFT

Nov 18, 2009 at 2:19 PM

You can use an attached behaviour to bind the SelectedDates property to an ObservableCollection<DateTime>, using a slightly modified version of the code from the ListBox.SelectedItems binding post on the Functional Fun blog: