private static void TextBox_Loaded(object sender, RoutedEventArgs e)
        {
            TextBoxBase textBox = (TextBoxBase)sender;

            textBox.Loaded -= Watermarking.TextBox_Loaded;
            if (Watermarking.GetContent(textBox) is object content)
            {
                Watermarking.SetAdorner(textBox, new WatermarkAdorner(textBox, content, Watermarking.GetContentTemplate(textBox)));
            }
        }
 private static void ContentProperty_ValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     if (!(d is TextBoxBase textBox))
     {
         return;
     }
     if (textBox.IsLoaded)
     {
         Watermarking.SetAdorner(textBox, e.NewValue == null ? default : new WatermarkAdorner(textBox, e.NewValue, Watermarking.GetContentTemplate(textBox)));
     }
     else if (e.NewValue != null && e.OldValue == null)
     {
         textBox.Loaded += Watermarking.TextBox_Loaded;
     }
     else if (e.NewValue == null && e.OldValue != null)
     {
         textBox.Loaded -= Watermarking.TextBox_Loaded;
     }
 }