public void ClearRichEditBox()
        {
            SysEditBox.Focus(FocusState.Keyboard);
            SysEditBox.Document.Selection.SetRange(0, SysEditBox.Document.Selection.EndPosition);
            ITextSelection sve = SysEditBox.Document.Selection;

            sentenceService.UndoVisualChangeAnno(sve);
            SysEditBox.Focus(FocusState.Keyboard);
            SysEditBox.Document.Selection.SetRange(0, 0);
        }
        private void annoTreeView_ItemInvoked(TreeView sender, TreeViewItemInvokedEventArgs args)
        {
            var       node   = args.InvokedItem as TreeViewNode;
            Dimension selDim = node.Content as Dimension;

            ITextSelection selectedText = SysEditBox.Document.Selection;


            // selectedText.SetRange(selectedText.StartPosition, selectedText.EndPosition - 1);

            ViewModel.Annotate(selectedText, selDim);
            AnnoNameTextBlock.Text = selDim.Name;

            string str;

            SysEditBox.Document.Selection.GetText(TextGetOptions.FormatRtf, out str);
            var end = str.Length - 1;

            SysEditBox.Document.Selection.SetRange(end, end); // !!!!!!!!!!!!!!!
            SysEditBox.Focus(FocusState.Keyboard);
        }