Пример #1
0
 private static void OnAutoScroll(TextBoxBase textBox)
 {
     if (textBox != null)
     {
         textBox.ScrollToEnd();
     }
 }
Пример #2
0
        private static void AutoScroll(TextBoxBase control)
        {
            var scrollPosition = GetScrollVerticalAlignment(control);

            if (scrollPosition == VerticalAlignment.Bottom && control.IsVisible)
            {
                control.ScrollToEnd();
            }
        }
 /// <summary>
 /// writes the message to the box (if available)
 /// </summary>
 /// <param name="message">the message to output</param>
 public new void WriteMessage(string message)
 {
     base.WriteMessage(message);
     outputTextBox.Dispatcher.Invoke(new Action(() =>
     {
         outputTextBox.AppendText(message + "\n");
         outputTextBox.ScrollToEnd();
     })
                                     );
 }
Пример #4
0
        private void TextBox_TextChanged_ScrollToEnd(object sender, TextChangedEventArgs e)
        {
            //textBox_status.ScrollToEnd();
            TextBoxBase tb = sender as TextBoxBase;

            if (tb == null)
            {
                return;
            }
            tb.ScrollToEnd();
        }
Пример #5
0
        public void WriteLog(string message)
        {
            if (textElement == null)
            {
                return;
            }

            string time = DateTime.Now.ToString("HH:mm:ss");

            try
            {
                textElement.Dispatcher.Invoke(() => textElement.AppendText($"{time} - {message}" + Environment.NewLine));
                textElement.Dispatcher.Invoke(() => textElement.ScrollToEnd());
            }
            catch (OperationCanceledException ex)
            {
                Debug.WriteLine($"LOGGER: {ex.Message}");
            }
        }
Пример #6
0
 public static void AppendLine(this TextBoxBase box, string text)
 {
     box.AppendText(text + Environment.NewLine);
     box.ScrollToEnd();
 }