private static void DateCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { MonthDay monthDay = (MonthDay)d; DateTime newValue = (DateTime)e.NewValue; monthDay.ThreadSafeDate = newValue; monthDay.IsToday = newValue == DateTime.Now.Date; }
private static void DisplayTextCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { MonthDay monthDay = (MonthDay)d; if (e.NewValue != null) { string[] split = ((string)e.NewValue).Split(' '); if (split.Length == 1) { monthDay.ShortDisplayText = split[0]; } else { monthDay.ShortDisplayText = split[1].TrimEnd(','); } } else { monthDay.ShortDisplayText = null; } }
private static void ClearAllCanExecute(object sender, CanExecuteRoutedEventArgs e) { MonthDay monthDay = (MonthDay)sender; e.CanExecute = monthDay.PART_StackPanel != null ? monthDay.PART_StackPanel.HasItems : false; }