示例#1
0
        private void OnContentTextSelectionChanged(
            object sender, RoutedEventArgs e)
        {
            if (_viewModel != null)
            {
                _viewModel.SelectedText = ContentText.SelectedText;

                var selectionStart = ContentText.SelectionStart;
                var line           = ContentText
                                     .GetLineIndexFromCharacterIndex(selectionStart);
                var column = selectionStart -
                             ContentText.GetCharacterIndexFromLineIndex(line);
                _viewModel.CaretLine    = line;
                _viewModel.CaretColumn  = column;
                _viewModel.IndexOfCaret = selectionStart;
            }
        }