private void OpenDatePicker() { if (!txtDetailsDate.Text.Trim().Equals("")) { IsUpdateDialogDate = false; DateTime currentDate = MH_Utils.Utils.getDateFromString(txtDetailsDate.Text.Trim()).AddMonths(-1); datePicker1.UpdateDate(currentDate.Year, currentDate.Month, currentDate.Day); } datePicker1.Visibility = ViewStates.Visible; datePicker1.BringToFront(); }
private void btn_StartDate_Click(object sender, EventArgs e) { if (IsDatePickerFocused) { IsDatePickerFocused = false; } else { var btnLocation = btn_StartDate.Location; DatePicker.Show(); DatePicker.Location = new System.Drawing.Point(btnLocation.X - (DatePicker.Width - btn_StartDate.Width) / 2, btnLocation.Y + 24); DatePicker.BringToFront(); DatePicker.Focus(); IsDatePickerFocused = true; } }