using MahApps.Metro.Controls; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; namespace Tango.MachineStudio.UI.Console { /// /// Interaction logic for ConsoleWindow.xaml /// public partial class ConsoleWindow : MetroWindow { private ConsoleWindowVM _vm; public ConsoleWindow() { InitializeComponent(); this.Loaded += (_, __) => { _vm = this.DataContext as ConsoleWindowVM; _vm.SetLogTextBox(txtLog); }; } //Auto scroll to bottom of response log each time it is changed. private void TextBox_TextChanged(object sender, TextChangedEventArgs e) { txtLog.SelectionStart = txtLog.Text.Length; txtLog.ScrollToEnd(); } } }