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

Custom Links

1 Answer 95 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Braulio
Top achievements
Rank 1
Braulio asked on 12 Oct 2011, 03:57 PM
Hi,
we are evaluating RadRichTextBox at the moment, because we have some specifice requirements.

We wanna show a textbox where the user can enter simple text, but furthermore we have some custom links in the text. This links point to another item in our application.

This can look like this:

"[X] is doing [Y]" where [X] and [Y] are two links. The source of this links are simple Ids, but we also wanna shows some custom tooltip.

I guess that I can do this using a InlineUIContainer.
 
The second requirement is that we wanna support Intellisense for the links, how can we do this and is there any example for this requirement?

1 Answer, 1 is accepted

Sort by
0
Boby
Telerik team
answered on 18 Oct 2011, 09:52 AM
Hello Braulio,
You can customize the default hyperlinks by putting some special info in the navigate URL, and then parse it in the hyperlink click event, for example:
public MainWindow()
{
    InitializeComponent();
 
    this.radRichTextBox.HyperlinkToolTipFormatString = "{1} to go to the user with id: {0}";
    this.radRichTextBox.HyperlinkNavigationMode = HyperlinkNavigationMode.Click;
    this.radRichTextBox.HyperlinkClicked += this.radRichTextBox_HyperlinkClicked;
}
 
void radRichTextBox_HyperlinkClicked(object sender, HyperlinkClickedEventArgs e)
{
    MessageBox.Show("Navigate to user with id: " + e.URL);
}
 
private void Button_Click(object sender, RoutedEventArgs e)
{
    HyperlinkInfo hyperlinkInfo = new HyperlinkInfo()
    {
        NavigateUri = "1234"
    };
 
    this.radRichTextBox.InsertHyperlink(hyperlinkInfo, "user X");
}
For more info on how to use hyperlinks, please refer to this help article.
Unfortunately Intellisense-like functionality is not implemented, and we believe it is out-of-scope of RadRichTextBox as a product.

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

Best wishes,
Boby
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
RichTextBox
Asked by
Braulio
Top achievements
Rank 1
Answers by
Boby
Telerik team
Share this question
or