예제 #1
0
        void OnClickDate(object sender, EventArgs e)
        {
            Android.App.DatePickerDialog datePicker = new Android.App.DatePickerDialog(Context, (s, args) => { Date = args.Date; DateBut.Text = Date.ToString("d"); }, DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);

            datePicker.DatePicker.MinDate = Calendar.Instance.TimeInMillis;
            datePicker.UpdateDate(DateTime.Now);
            datePicker.Show();
        }
예제 #2
0
        public override Android.App.Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            Android.App.DatePickerDialog dialog = new Android.App.DatePickerDialog(Activity
                                                                                   , Resource.Style.Theme_AppCompat_Light_Dialog
                                                                                   , this
                                                                                   , _defaultDate.Year
                                                                                   , _defaultDate.Month
                                                                                   , _defaultDate.Day);

            dialog.UpdateDate(_defaultDate);

            if (_minDate.HasValue)
            {
                dialog.DatePicker.MinDate = UnixTimestampFromDateTime(_minDate.Value);
            }
            if (_maxDate.HasValue)
            {
                dialog.DatePicker.MaxDate = UnixTimestampFromDateTime(_maxDate.Value);
            }

            return(dialog);
        }