예제 #1
0
        private void RichText_TextChanged(object sender, TextChangedEventArgs e)
        {
            //string richText = new TextRange(richTextBox1.Document.ContentStart, richTextBox1.Document.ContentEnd).Text;
            string temp = new TextRange(RichText.Document.ContentStart, RichText.Document.ContentEnd).Text;

            CountLabel.Content = "Число символов:" + (temp.Count() - 2);
        }
예제 #2
0
        /// <summary>
        /// Обновить количество символов и слов в статус-баре
        /// </summary>
        private void UpdateStatusBar()
        {
            UserDocumentTab userDocumentTab = GetSelectedUserDocumentTab();

            if (userDocumentTab != null)
            {
                RichTextBox documentContent = userDocumentTab.Content as RichTextBox;
                string      text            = new TextRange(documentContent.Document.ContentStart, documentContent.Document.ContentEnd).Text;

                NumOfSymbols.Content = text.Count().ToString();
                NumOfWords.Content   = text.WordCount().ToString();
            }
        }