private static void OnWatermarkChanged(DependencyObject sender, DependencyPropertyChangedEventArgs ea)
        {
            WatermarkTextBox textBox = sender as WatermarkTextBox;

            if (textBox.IsWatermarkShown)
            {
                textBox.ShowWatermark();
            }
        }
        private static void OnKeyboardFocusChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            WatermarkTextBox tb = d as WatermarkTextBox;

            tb.ShowCaret();
            if (tb.KeyboardFocus)
            {
                RoutedEventArgs newEventArgs = new RoutedEventArgs(WatermarkTextBox.KeyboardFocusEvent);
                tb.RaiseEvent(newEventArgs);
            }
        }
        private void contentHost_TouchDown(object sender, TouchEventArgs e)
        {
            Control content = sender as Control;

            if (null != content)
            {
                TouchPoint tp     = e.GetTouchPoint(content);
                Rect       bounds = new Rect(new Point(0, 0), content.RenderSize);
                if (bounds.Contains(tp.Position))
                {
                    WatermarkTextBox tb = content.TemplatedParent as WatermarkTextBox;
                    if (null != tb)
                    {
                        tb.KeyboardFocus = true;
                    }
                }
                content.ReleaseTouchCapture(e.TouchDevice);
            }
        }
        private void TextBox_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            WatermarkTextBox tb = sender as WatermarkTextBox;

            tb.ShowCaret();
        }
        private static void OnWatermarkBorderColorChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            WatermarkTextBox textBox = sender as WatermarkTextBox;

            textBox.BorderBrush = textBox.WatermarkBorderColor;
        }