private static void OnAutoScroll(TextBoxBase textBox) { if (textBox != null) { textBox.ScrollToEnd(); } }
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(); }) ); }
private void TextBox_TextChanged_ScrollToEnd(object sender, TextChangedEventArgs e) { //textBox_status.ScrollToEnd(); TextBoxBase tb = sender as TextBoxBase; if (tb == null) { return; } tb.ScrollToEnd(); }
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}"); } }
public static void AppendLine(this TextBoxBase box, string text) { box.AppendText(text + Environment.NewLine); box.ScrollToEnd(); }