/// <summary> /// Called when watermark property is changed. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> instance containing the event data.</param> private static void OnWatermarkPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) { WatermarkedTextBox watermarkTextBox = sender as WatermarkedTextBox; Debug.Assert(watermarkTextBox != null, "The source is not an instance of a WatermarkedTextBox!"); watermarkTextBox.OnWatermarkChanged(); watermarkTextBox.ToggleState(); }
/// <summary> /// Called when is enabled property is changed. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> instance containing the event data.</param> private static void OnIsEnabledPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) { WatermarkedTextBox watermarkedTextBox = sender as WatermarkedTextBox; Debug.Assert(watermarkedTextBox != null, "The source is not an instance of a WatermarkedTextBox!"); bool newValue = (bool)args.NewValue; //MIX-only solution, as IsEnabled is not defined on Control level watermarkedTextBox.IsHitTestVisible = newValue; watermarkedTextBox.IsTabStop = newValue; watermarkedTextBox.IsReadOnly = !newValue; watermarkedTextBox.ToggleState(); }