Search code examples
c#wpfmvvmcaliburn.microivalueconverter

Caliburn.Micro Value Converter


In a WPF MVVM (caliburn micro) application I need to bind a DateTimeOffset property to a wpf DatePicker control (SelectedDate property).

I think I can use caliburn micro's value converter feature to convert DateTimeOffset to DateTime and vice versa. Could anyone please provide me the steps with sample code?

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

Solution

  • <DatePicker SelectedDate="{Binding DateofBirth, Converter={StaticResource DateConverter}}" /> which means you would need to write a converter from datetime to DateTimeOffSet. Not really all that hard. It has nothing to do with Caliburn Micro, not sure what docs you are referring to..