Exemplo n.º 1
0
        private static void SelectionLengthExChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TextBoxEx textBox = (TextBoxEx)d;

            textBox.Focus();
            textBox.SelectionLength = (int)e.NewValue;
        }
Exemplo n.º 2
0
        private static void CaretIndexExChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TextBoxEx textBox = (TextBoxEx)d;

            textBox.Focus();
            int value = (int)e.NewValue;
            int line  = textBox.GetLineIndexFromCharacterIndex(value);

            if (line >= 0)
            {
                textBox.ScrollToLine(line);
            }
        }