Hello,
It is more recommended to read and save the DatePicker via MVVM style, you could refer to the following documentation and video:
Then, you could refer to the following specific code:
Create your Model class, such as User:
public class User
{
public DateTime BirthDay { get; set; }
}
Add user property and command to binding the value of datepicker for saving.
public class AboutViewModel : BaseViewModel
{
public ICommand SaveToFireBaseCommand { get; }
private async Task SaveToFireBase()
{
// Save User into FireBase.
}
private User _user;
public User User
{
get
{
return _user;
}
set
{
SetProperty(ref _user, value);
}
}
public AboutViewModel()
{
User = new User();
SaveToFireBaseCommand = new Command(async () => await SaveToFireBase());
}
}
Finally, binding the properties on XAML.
<c:BirthdayDatePickerControl Date="{Binding User.BirthDay}"/>
<Button Text="Submit" Command="{Binding SaveToFireBaseCommand}"/>
Best Regards,
Alec Liu.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.