Reputation: 107
Currently have a Droid app implemented that in response to a button press pops up a DatePickerDialog.
As this must be a common use case does anyone have any suggestions how to achieve something similar with Touch?
Not sure if an AlertView can be used & if so how or what would be a suitable approach...
A pointer to an existing sample or project that does something similar would be appreciated.
TIA
Andreas
Upvotes: 1
Views: 450
Reputation: 66882
Assuming my UI designers agree (sometimes they like to do things differently)... I'd use a UIDatePicker
- see
As a fairly experience MonoTouch and MvvmCross dev I would do this by:
UIView
(maybe subclassing UIButton
or UILabel
) for my on-screen displayUIView
when edit is needed, I would use a UIDatePicker
with code like that inside https://github.com/slodge/MvvmCross/blob/vnext/CrossUI/CrossUI.Touch/Dialog/Elements/DateTimeElement.cspublic DateTime Value {get;set;}
property and a public event EventHandler ValueChanged
eventSetup
- very similar to how it's now in this Droid question - Bind TimePicker & DatePicker - MVVMCross (Mono For Android)UIView
in my 'page' with two-way binding on Value
If I were in more of a hurry though, I might instead:
UIViewController
to hook up the button TouchUpInside
to some code to show a UIDatePicker
UIDatePicker
events in order to set properties back in the ViewModelUpvotes: 1