public static void UnitCulturePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { MeasurementBtn mBtn = (MeasurementBtn)d; UnitCultureId? val = (UnitCultureId?)e.NewValue; if (val == UnitCultureId.Imperial) { mBtn.showImperialStoryBoard.Begin(); } else { mBtn.showMetricStoryBoard.Begin(); } }
public static void IsCandidatePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { MeasurementBtn mBtn = (MeasurementBtn)d; bool isCandidate = (bool)e.NewValue; if (isCandidate) { mBtn.candidateStoryBoard.Begin(); } else { mBtn.candidateStoryBoard.Stop(); } }
public static void MetricValueTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { MeasurementBtn mBtn = (MeasurementBtn)d; string val = (string)e.NewValue; if (val == null || val == String.Empty) { mBtn.metricValueTextBlock.Text = ""; } else { mBtn.metricValueTextBlock.Text = val; } }
public static void ImperialValueTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { MeasurementBtn mBtn = (MeasurementBtn)d; string val = (string)e.NewValue; // Only do the state change in the imperial value event handler to prevent doubling up of animation etc. if (val == null || val == String.Empty) { if (mBtn.HasMeasurements) { mBtn.GoToNoMeasurementState(); } mBtn.imperialValueTextBlock.Text = ""; } else { if (!mBtn.HasMeasurements) { mBtn.GoToHasMeasurementState(); } mBtn.imperialValueTextBlock.Text = val; } }
public static void MeasurementNamePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { MeasurementBtn mBtn = (MeasurementBtn)d; mBtn.titleTextBlock.Text = (string)e.NewValue; }