private void CodeEditor_TextChanged(object sender, TextChangedEventArgs e) { var linesCount = CodeEditor.Text.Split('\n').Count(); Lines = new ObservableCollection <int>(Enumerable.Range(1, linesCount)); LineNumbers.ItemsSource = Lines; LineNumbers.ScrollIntoView(linesCount); }
private void SynchroScroll(object sender, ScrollChangedEventArgs e) { if (sender == CodeEditor) { LineNumbers.ScrollIntoView(e.VerticalChange); } else { CodeEditor.ScrollToVerticalOffset(e.VerticalOffset); } }