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