I have model class in shared PCL (for android and uwp app) that contain datetime property:
public class Meter {
public int meter_value {get; set; }
public DateTime meter_start { get; set; }
public DateTime meter_end { get; set; }
... other int and string properties
}
In MainPage.cs i have
public Meter _meter;
public MainPage()
{
this.InitializeComponent();
_meter = new Meter();
}
I'm trying to bind this to a xaml controls with following code:
<TextBox
Text="{x:Bind _meter.meter_value, Mode=TwoWay}">
<CalendarDatePicker
Name="meter_start"
Date="{x:Bind _meter.meter_start, Mode=TwoWay}"
DateFormat="{}{day.integer}/{month.integer}/{year.full}" >
</CalendarDatePicker>
This code produce compile time error: Invalid binding path '_meter.meter_start' : Cannot bind type 'System.DateTime' to 'System.Nullable(System.DateTimeOffset)' without a converter
When i change x:Bind to Binding, applicaton compile, but value of meter_start property in my model is 0001/01/01.
Can someone help me how to solve this?