This is a migrated thread and some comments may be shown as answers.

Remove hyperlink

1 Answer 215 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Tatiana
Top achievements
Rank 1
Tatiana asked on 21 Mar 2011, 02:12 PM
First of all good job on the RadRichTextBox!

I need to remove a hyperlink that is handed to me as a Span
I tried to removing it by using the RemoveHyperlink method but I just cant get the caret to move to the span's location...

how can I remove the link?

internal void RemoveEntity(Span span)
{
     //TODO:set caret to span's positioning
  
      ui_txtCtrl.RemoveHyperlink();
}


Thanks



 

1 Answer, 1 is accepted

Sort by
0
Accepted
Boby
Telerik team
answered on 24 Mar 2011, 09:57 AM
Hello Jerry,

Here is a sample code for achieving this:

internal void RemoveEntity(Span span)
{
    InlineLayoutBox associatedLayoutBox = span.GetAssociatedLayoutBoxes().First() as InlineLayoutBox;
    this.ui_txtCtrl.Document.CaretPosition.MoveToInline(associatedLayoutBox, 0);
 
    ui_txtCtrl.RemoveHyperlink();
}

Don't hesitate to contact us if you have other questions.

All the best,
Boby
the Telerik team
Tags
RichTextBox
Asked by
Tatiana
Top achievements
Rank 1
Answers by
Boby
Telerik team
Share this question
or