/// <summary> /// Sets the specified <paramref name="date"/> as the currently displayed date. /// </summary> /// <param name="date">The date to set.</param> private void SetNewDate(DateTime date) { this.currentDate = date; if (this.CheckDate != null) { CheckDateEventArgs checkEventArgs = new CheckDateEventArgs(date, true); this.CheckDate(this, checkEventArgs); this.isValidDate = checkEventArgs.IsValid; this.Invalidate(); } }
/// <summary> /// Handles the <see cref="DatePickerDateTextBox.CheckDate"/> event. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">A <see cref="CheckDateEventArgs"/> that contains the event data.</param> private void DateTextBoxCheckDate(object sender, CheckDateEventArgs e) { this.monthCalendar.SelectionRange = new SelectionRange(e.Date, e.Date); this.monthCalendar.EnsureSeletedDateIsVisible(); CheckDateEventArgs newArgs = new CheckDateEventArgs(e.Date, this.IsValidDate(e.Date)); this.OnValueChanged(newArgs); e.IsValid = newArgs.IsValid; }
/// <summary> /// Raises the <see cref="ValueChanged"/> event. /// </summary> /// <param name="e">A <see cref="EventArgs"/> that contains the event data.</param> protected virtual void OnValueChanged(CheckDateEventArgs e) { if (this.ValueChanged != null) { this.ValueChanged(this, e); } }