private static void UseValidTimesChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { TimeCtrl tc = d as TimeCtrl; if (tc != null && e.NewValue is bool) { tc.SetIsValidTime(); } }
private static void TextAlignmentChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { TimeCtrl tc = d as TimeCtrl; if (tc != null && e.NewValue is TextAlignment) { tc.TextBoxCtrl.TextAlignment = (TextAlignment)e.NewValue; tc.ReloadTimeCtrlsGrid(); } }
void ChangeTimeCtrlAlignment(TimeCtrl tc) { if (tc.TextAlignment == TextAlignment.Left) { tc.TextAlignment = TextAlignment.Center; } else if (tc.TextAlignment == TextAlignment.Center) { tc.TextAlignment = TextAlignment.Right; } else { tc.TextAlignment = TextAlignment.Left; } }
private static void IsValidTimeChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { TimeCtrl tc = d as TimeCtrl; if (tc != null && e.NewValue is bool) { foreach (FrameworkElement fe in tc.TimeCtrls.Children) { if (fe is TextBox) { ((TextBox)fe).Foreground = tc.TextBrush; } else if (fe is TextBlock) { ((TextBlock)fe).Foreground = tc.TextBrush; } } } }
private static void ValueChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { TimeCtrl tc = d as TimeCtrl; if (tc != null && e.NewValue is DateTime) { foreach (UIElement ele in tc.TimeCtrls.Children) { var ctrl = ele as FrameworkElement; HMSType hmsType = ctrl.get_HMSType(); if (hmsType != HMSType.unknown) { var tb = ctrl as TextBox; if (tb != null) { tb.set_HMSText((DateTime)e.NewValue); } } } tc.SetIsValidTime(); } }