protected override void OnElementChanged(ElementChangedEventArgs <DatePicker> e) { base.OnElementChanged(e); if (Control == null || e.NewElement == null) { return; } Control.SetBackgroundResource(Resource.Drawable.StyleEntry); Control.SetTextColor(Android.Graphics.Color.ParseColor("#6e6e6e")); Control.SetBackgroundColor(Android.Graphics.Color.Transparent); Control.SetPaddingRelative(20, 20, 20, 20); GradientDrawable gd = new GradientDrawable(); gd.SetCornerRadius(10); gd.SetColor(Android.Graphics.Color.Transparent); gd.SetStroke(3, Android.Graphics.Color.ParseColor("#EEEEEE")); Control.Background = gd; DatePickerCtrl element = Element as DatePickerCtrl; if (!string.IsNullOrWhiteSpace(element.Placeholder)) { Control.Text = element.Placeholder; } this.Control.TextChanged += this.Control_TextChanged; }
protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.DatePicker> e) { base.OnElementChanged(e); //this.Control.SetTextColor(Android.Graphics.Color.LightGray); this.Control.SetBackgroundColor(Android.Graphics.Color.Transparent); this.Control.SetPadding(20, 0, 0, 0); GradientDrawable gd = new GradientDrawable(); gd.SetCornerRadius(10); //increase or decrease to changes the corner look gd.SetColor(Android.Graphics.Color.Transparent); gd.SetStroke(1, Xamarin.Forms.Color.FromRgb(211, 211, 211).ToAndroid()); this.Control.SetBackgroundDrawable(gd); DatePickerCtrl element = Element as DatePickerCtrl; if (!string.IsNullOrWhiteSpace(element.Placeholder)) { this.Control.SetTextColor(Android.Graphics.Color.Gray); Control.Text = element.Placeholder; } this.Control.TextChanged += (sender, arg) => { var selectedDate = arg.Text.ToString(); if (selectedDate == element.Placeholder) { Control.Text = DateTime.Now.ToString("dd/MM/yyyy"); //this.Control.SetTextColor(Android.Graphics.Color.Gray); } }; }
protected override void OnElementChanged(ElementChangedEventArgs <DatePicker> e) { base.OnElementChanged(e); this.Control.SetTextColor(Android.Graphics.Color.Gray); ////this.Control.SetTextColor(Android.Graphics.Color.Rgb(83, 63, 149)); //this.Control.SetBackgroundColor(Android.Graphics.Color.Transparent); //this.Control.SetPadding(20, 0, 0, 0); //GradientDrawable gd = new GradientDrawable(); ////gd.SetCornerRadius(25); //increase or decrease to changes the corner look //gd.SetColor(Android.Graphics.Color.Transparent); //gd.SetStroke(3, Android.Graphics.Color.Rgb(83, 63, 149)); //this.Control.SetBackgroundDrawable(gd); DatePickerCtrl element = Element as DatePickerCtrl; if (!string.IsNullOrWhiteSpace(element.Placeholder)) { Control.Text = element.Placeholder; } this.Control.TextChanged += (sender, arg) => { this.Control.SetTextColor(Android.Graphics.Color.Black); var selectedDate = arg.Text.ToString(); if (selectedDate == element.Placeholder) { Control.Text = DateTime.Now.ToString("dd/MM/yyyy"); } }; }
public Control CreateControl(Rectangle rect, IPropType type, object curValue, bool valuesDiffer) { _datePicker = new DatePickerCtrl(); _datePicker.Bounds = rect; _datePicker.ShowClearButton = true; if (curValue != null) { _datePicker.CurrentDate = (DateTime)curValue; } _datePicker.ValueChanged += new EventHandler(OnValueChanged); return(_datePicker); }
protected override void OnElementChanged(ElementChangedEventArgs <DatePicker> e) { base.OnElementChanged(e); DatePickerCtrl element = Element as DatePickerCtrl; if (!string.IsNullOrWhiteSpace(element.Placeholder)) { Control.Text = element.Placeholder; } this.Control.TextChanged += (sender, arg) => { var selectedDate = arg.Text.ToString(); if (selectedDate == element.Placeholder) { Control.Text = DateTime.Now.ToString("dd/MMM/yyyy"); } }; }
private void Control_TextChanged(object sender, Android.Text.TextChangedEventArgs arg) { DatePickerCtrl element = Element as DatePickerCtrl; var selectedDate = arg.Text.ToString(); //if (selectedDate == element.Placeholder) //{ // Control.Text = DateTime.Now.ToString("dd/MM/yyyy"); //} //var initDate = DateTime.Now.AddDays(1).Date.ToString("dd/MM/yyyy"); //var initDate = default(DateTime).ToString("dd/MM/yyyy"); /*if (selectedDate == DateTime.Now.Date.ToString("dd/MM/yyyy")) * { * Control.TextChanged -= Control_TextChanged; * Control.Text = element.PlaceHolder; * element.IsInitValue = true; * Control.TextChanged += Control_TextChanged; * } * else * { * Control.TextChanged -= Control_TextChanged; * Control.Text = selectedDate; * element.IsInitValue = false; * Control.TextChanged += Control_TextChanged; * }*/ if (selectedDate != element.Placeholder) { Control.TextChanged -= Control_TextChanged; Control.Text = selectedDate; element.IsInitValue = false; Control.TextChanged += Control_TextChanged; } }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this._homePageLinkLabel = new JetBrains.Omea.GUIControls.JetLinkLabel(); this.labelBirthday = new System.Windows.Forms.Label(); this.labelHomePage = new System.Windows.Forms.Label(); this._homePage = new JetBrains.Omea.ContactsPlugin.PropertyEditor(); this._birthday = new JetBrains.Omea.GUIControls.DatePickerCtrl(); this.labelBirthdayDate = new System.Windows.Forms.Label(); this.SuspendLayout(); // // _homePageLinkLabel // this._homePageLinkLabel.AllowDrop = true; this._homePageLinkLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this._homePageLinkLabel.Cursor = System.Windows.Forms.Cursors.Hand; this._homePageLinkLabel.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(204))); this._homePageLinkLabel.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(70)), ((System.Byte)(70)), ((System.Byte)(211))); this._homePageLinkLabel.Location = new System.Drawing.Point(92, 28); this._homePageLinkLabel.Name = "_homePageLinkLabel"; this._homePageLinkLabel.Size = new System.Drawing.Size(96, 16); this._homePageLinkLabel.TabIndex = 24; this._homePageLinkLabel.Click += new System.EventHandler(this._homePageLinkLabel_Click); // // label10 // this.labelBirthday.FlatStyle = System.Windows.Forms.FlatStyle.System; this.labelBirthday.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(204))); this.labelBirthday.Location = new System.Drawing.Point(4, 4); this.labelBirthday.Name = "labelBirthday"; this.labelBirthday.Size = new System.Drawing.Size(64, 16); this.labelBirthday.TabIndex = 23; this.labelBirthday.Text = "Birthday:"; // // label9 // this.labelHomePage.FlatStyle = System.Windows.Forms.FlatStyle.System; this.labelHomePage.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(204))); this.labelHomePage.Location = new System.Drawing.Point(4, 28); this.labelHomePage.Name = "labelHomePage"; this.labelHomePage.Size = new System.Drawing.Size(72, 16); this.labelHomePage.TabIndex = 21; this.labelHomePage.Text = "Home page:"; // // _homePage // this._homePage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this._homePage.ForeColor = System.Drawing.SystemColors.HotTrack; this._homePage.Location = new System.Drawing.Point(92, 28); this._homePage.Multiline = false; this._homePage.Name = "_homePage"; this._homePage.ReadOnly = false; this._homePage.Size = new System.Drawing.Size(104, 24); this._homePage.TabIndex = 7; // // _birthday // this._birthday.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this._birthday.CurrentDate = new System.DateTime(((long)(0))); this._birthday.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(204))); this._birthday.Location = new System.Drawing.Point(92, 0); this._birthday.Name = "_birthday"; this._birthday.Size = new System.Drawing.Size(104, 24); this._birthday.TabIndex = 5; // // _lblBirthday // this.labelBirthdayDate.FlatStyle = System.Windows.Forms.FlatStyle.System; this.labelBirthdayDate.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(204))); this.labelBirthdayDate.Location = new System.Drawing.Point(92, 4); this.labelBirthdayDate.Name = "labelBirthdayDate"; this.labelBirthdayDate.Size = new System.Drawing.Size(100, 16); this.labelBirthdayDate.TabIndex = 25; this.labelBirthdayDate.Text = "label1"; this.labelBirthdayDate.Visible = false; // // DetailsBlock // this.Controls.Add(this.labelBirthdayDate); this.Controls.Add(this._homePageLinkLabel); this.Controls.Add(this.labelBirthday); this.Controls.Add(this.labelHomePage); this.Controls.Add(this._homePage); this.Controls.Add(this._birthday); this.Name = "DetailsBlock"; if (Core.ScaleFactor.Height == 1.0) { this.Size = new System.Drawing.Size(200, 52); } else { this.Size = new System.Drawing.Size(200, (int)(52 * Core.ScaleFactor.Height)); } this.ResumeLayout(false); }