private static void TimePropertyChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs arg) { if (sender != null && sender is ClockUserCtrl) { ClockUserCtrl clock = sender as ClockUserCtrl; clock.OnTimeUpdated((DateTime)arg.OldValue, (DateTime)arg.NewValue);//更新前后的值 } }
private static void ExecuteSpeak(object sender, ExecutedRoutedEventArgs arg) { ClockUserCtrl clock = sender as ClockUserCtrl; if (clock != null) { clock.SpeakTheTime(); } }
private static void CanExecuteSpeak(object sender, CanExecuteRoutedEventArgs arg) { ClockUserCtrl clock = sender as ClockUserCtrl; arg.CanExecute = (clock != null); }