예제 #1
0
        private void UpdateLineCountAndCaret()
        {
            if (MainTextbox == null)
            {
                return;
            }
            if (LineCountLabel != null)
            {
                LineCountLabel.Content = MainTextbox.LineCount;
            }

            if (CaretLabel != null && CurrentLineLabel != null)
            {
                int caretIndex  = MainTextbox.CaretIndex;
                int currentline = MainTextbox.GetLineIndexFromCharacterIndex(caretIndex);

                CurrentLineLabel.Content = currentline;

                if (currentline == 0)
                {
                    CaretLabel.Content = caretIndex;
                }
                else if (currentline > 0)
                {
                    CaretLabel.Content = caretIndex - MainTextbox.GetCharacterIndexFromLineIndex(currentline);
                }
            }
        }
 protected override void OnActivated(EventArgs e)
 {
     base.OnActivated(e);
     MainTextbox.Focus();
     MainTextbox.SelectAll();
 }
 private void CopyClicked(object sender, RoutedEventArgs e)
 {
     MainTextbox.SelectAll();
     MainTextbox.Copy();
 }