Exemplo n.º 1
0
        private static void OnWatermarkChanged(DependencyObject sender, DependencyPropertyChangedEventArgs ea)
        {
            WatermarkTextBox textBox = sender as WatermarkTextBox;

            if (textBox.IsWatermarkShown)
            {
                textBox.ShowWatermark();
            }
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        private void TextBox_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            WatermarkTextBox tb = sender as WatermarkTextBox;

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

            textBox.BorderBrush = textBox.WatermarkBorderColor;
        }