Ejemplo n.º 1
0
        private void textBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (suppressUpdate)
            {
                return;
            }

            CustomRangeStart rangeStart = this.radRichTextBox.Document.EnumerateChildrenOfType <CustomRangeStart>().FirstOrDefault();

            if (rangeStart != null)
            {
                CustomRangeEnd rangeEnd = (CustomRangeEnd)rangeStart.End;

                DocumentPosition start = new DocumentPosition(this.radRichTextBox.Document);
                start.MoveToInline(rangeStart);

                DocumentPosition end = new DocumentPosition(this.radRichTextBox.Document);
                end.MoveToInline(rangeEnd);

                DocumentSelection selection = this.radRichTextBox.Document.Selection;// new DocumentSelection(this.radRichTextBox.Document);

                selection.SetSelectionStart(start);
                selection.AddSelectionEnd(end);

                this.radRichTextBox.Insert(this.textBox.Text);
            }
        }
Ejemplo n.º 2
0
        private void UpdateTextBoxText()
        {
            string textInRange;

            CustomRangeStart rangeStart = this.radRichTextBox.Document.EnumerateChildrenOfType <CustomRangeStart>().FirstOrDefault();

            if (rangeStart != null)
            {
                CustomRangeEnd rangeEnd = (CustomRangeEnd)rangeStart.End;

                DocumentPosition start = new DocumentPosition(this.radRichTextBox.Document);
                start.MoveToInline(rangeStart);

                DocumentPosition end = new DocumentPosition(this.radRichTextBox.Document);
                end.MoveToInline(rangeEnd);

                DocumentSelection selection = new DocumentSelection(this.radRichTextBox.Document);

                selection.SetSelectionStart(start);
                selection.AddSelectionEnd(end);

                string text = selection.GetSelectedText();

                textInRange = text;
            }
            else
            {
                textInRange = string.Empty;
            }

            this.suppressUpdate = true;

            this.textBox.Text = textInRange;

            this.suppressUpdate = false;
        }
Ejemplo n.º 3
0
 protected override void CopyContentFromOverride(DocumentElement fromElement)
 {
     CustomRangeEnd other = (CustomRangeEnd)fromElement;
     // Copy your custom properties from other to this here.
 }