static void selectedDateChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { PersianDatePicker pdp = o as PersianDatePicker; pdp.Text = e.NewValue.ToString(); pdp.RaiseEvent(new RoutedEventArgs(SelectedDateChangedEvent, pdp)); }
static object coerceDateToBeInRange(DependencyObject d, object o) { PersianDatePicker pdp = d as PersianDatePicker; Mohsen.PersianDate value = (Mohsen.PersianDate)o; if (value < pdp.DisplayDateStart) { return(pdp.DisplayDateStart); } if (value > pdp.DisplayDateEnd) { return(pdp.DisplayDateEnd); } return(o); }