Вопрос

I made a DatePicker like that : https://github.com/eMi-/mvvmcross_datepicker_timepicker/ But I want to have this DatePicker in a dialog for monodroid and bind the selected date (mvvmcross). Someone has an idea how to do this?

The purpose is : when the user tap on the edittext the datepickerdialog is shown and he select the date and then he tap on 'OK' button, the dialogpickerdate disappear and the date appear in the edittext (ddmmyyyy).

Это было полезно?

Решение

In v3, there is some dialog fragment support allowing databinding.

However, for now, the easiest way to do what you want to do is:

  • when you create the dialog set the datetime using ViewModel.MyDateTimeProperty
  • within the dialog show the datepicker and listen for changes
  • when you want to - either live during changes or on OK - then write the value back to ViewModel.MyDateTimeProperty
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top