I have an UIDatePickerTextField created. This is an subclass of UITextField.
Functional
When a user clicks on the textfield, a popup datepicker will be shown. The user can select a date and click done. The value will be set to the textfield and its done.
In my view I use:
set.Bind(PickerTextField).For(x => x.Text).To(vm => vm.SelectedValue).TwoWay();
In the picker class i have implemented the interface IMvxBindable
so have the properties BindingContext
and DataContext
.
When the user clicks done the click event is catched and handles the last steps
private void DoneButton_Clicked(object sender, EventArgs e)
{
HideView();
DateTime userSelectedDate = DateTime.Parse(_datePickerControl.Date.ToString());
Text = userSelectedDate.ToString();
SendActionForControlEvents(UIControlEvent.ValueChanged);
}
But for some reason the Text property is correctly set and visible, but the ViewModel set is not triggered. What do I wrong and how can I fix this? I would prevent using the ViewModel inside this control to keep it generic.