Beispiel #1
0
        private void ShowDatePicker()
        {
            _isShowing = true;

            _dialog = new DatePickerDialog(Context, DatePicker_DateSet, Element.Date.Year, Element.Date.Month - 1, Element.Date.Day);

            _dialog.SetButton("Done", (sender, e) =>
            {
                Element.SelectedDate = _dialog.DatePicker.DateTime;
                Element.UpdateDate();
                SetText();
            });

            _dialog.SetButton2("Cancel", (sender, e) =>
            {
                _dialog.Hide();
            });

            _dialog.SetButton3("Clear", (sender, e) =>
            {
                Element.SelectedDate = null;
                Element.UpdateDate();
                SetText();
            });

            _dialog.DatePicker.DateTime = Element.SelectedDate ?? DateTime.Now;
            _dialog.DismissEvent       += (sender, args) => _isShowing = false;
            _dialog.Show();
        }
Beispiel #2
0
        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            DateTime         currently = DateTime.Now;
            DatePickerDialog dialog    =
                new DatePickerDialog(Activity,
                                     this,
                                     currently.Year,
                                     currently.Month - 1,
                                     currently.Day);

            dialog.SetButton3(new Java.Lang.String("Not Specified"), (s, args) => { setNoDateSetClicked(); });
            return(dialog);
        }
Beispiel #3
0
        void CreateDatePickerDialog(int year, int month, int day)
        {
            DatePickerXamDisableDates.DatePickerRender view = Element;
            _dialog = new DatePickerDialog(Context, (o, e) =>
            {
                view.Date = e.Date;
                ((IElementController)view).SetValueFromRenderer(VisualElement.IsFocusedProperty, false);
                Control.ClearFocus();

                _dialog = null;
            }, year, month, day);



            var languageDevice = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName;

            var done   = "تم";
            var cancel = "إلغاء";
            var clear  = "إعادة";

            if (languageDevice.ToLower().Contains("en"))
            {
                done   = "Done";
                cancel = "Cancel";
                clear  = "Clear";
            }
            _dialog.SetButton(done, (sender, e) =>
            {
                SetDate(_dialog.DatePicker.DateTime);
                this.Element.Format = this.Element._originalFormat;
                this.Element.AssignValue();
                // App.DateSelected = _dialog.DatePicker.DateTime;
            });

            _dialog.SetButton2(cancel, (sender, e) =>
            {
            });
            _dialog.SetButton3(clear, (sender, e) =>
            {
                this.Element.CleanDate();
                Control.Text = this.Element.Format;
                //App.DateSelected = default(DateTime);
            });
        }
        void CreateDatePickerDialog(int year, int month, int day)
        {
            CustomDatePicker view = Element;

            _dialog = new DatePickerDialog(Context, callBack: (o, e) =>
            {
                view.Date = e.Date;
                ((IElementController)view).SetValueFromRenderer(VisualElement.IsFocusedProperty, false);
                Control.ClearFocus();

                _dialog = null;
            }, year: year, monthOfYear: month, dayOfMonth: day);

            //Show Done button by default
            _dialog.SetButton("Done", (sender, e) =>
            {
                SetDate(_dialog.DatePicker.DateTime);
                this.Element.Format = this.Element._originalFormat;
                this.Element.AssignValue();
            });
            if (this.Element.ShowClearButton)
            {
                _dialog.SetButton2("Cancel", (sender, e) =>
                {
                    this.Element.Cancel();
                    Control.Text = this.Element.Format;
                });

                _dialog.SetButton3("Remove Date", (sender, e) =>
                {
                    this.Element.CleanDate();
                    Control.Text = this.Element.Format;
                });
            }
            else  //Show Cancel button by default
            {
                _dialog.SetButton2("Cancel", (sender, e) =>
                {
                    this.Element.Cancel();
                    Control.Text = this.Element.Format;
                });
            }
        }