我正在关注本教程:http://iosapi.xamarin.com/?link=T%3aXamarin.Forms.DatePicker并且似乎无法弄清楚如何获取返回值(日期)并将其保存到解析日期字段。
我使用下面的代码得到的错误消息是"参数超出范围。参数名称:index"
感谢您的反馈/指导
创建DatePicker
DatePicker birthDate = new DatePicker
{
Format = "D"
};
保存到解析
btnSubmit.Clicked += async (sender, ea) => {
try
{
Legacy legacy = new Legacy();
legacy["firstName"] = firstName.Text;
legacy["birthdate"] = birthDate;
await legacy.SaveAsync();
}
catch (Exception e)
{
// Signup failed, show alert
await DisplayAlert ("Please Try Again!", e.Message, "OK");
}
};
答案 0 :(得分:1)
尝试将其更改为
legacy["birthdate"] = birthDate.Date;