/// <summary> /// Updates the <see cref="WatermarkAdorner"/> on the <see cref="Control"/>. /// </summary> /// <param name="control">A <see cref="Control"/>.</param> private static void UpdateWatermark(Control control) { object hint = GetHint(control); Brush brush = GetHintBrush(control); if (!control.IsKeyboardFocused && !HasActualValue(control) && hint != null && brush != null) { WatermarkAdorner watermarkAdorner = GetWatermarkAdorner(control); if (watermarkAdorner == null) { AddWatermarkAdorner(control, hint, brush); } else { watermarkAdorner.Hint = hint; watermarkAdorner.Brush = brush; UpdateAdornerLayer(control); } } else { RemoveWatermarkAdorner(control); } }
/// <summary> /// Updates the <see cref="WatermarkAdorner"/> on the <see cref="Control"/>. /// </summary> /// <param name="control">A <see cref="Control"/>.</param> private static void UpdateWatermark(Control control) { if (!control.IsKeyboardFocused && !HasActualValue(control)) { WatermarkAdorner watermarkAdorner = GetWatermarkAdorner(control); object hint = GetHint(control); if (watermarkAdorner == null) { AddWatermarkAdorner(control, hint); } else if (!object.Equals(watermarkAdorner.Hint, hint)) { watermarkAdorner.Hint = hint; } } else { RemoveWatermarkAdorner(control); } }