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

IInsertHyperlinkDialog Changed

5 Answers 110 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Stephen
Top achievements
Rank 1
Stephen asked on 18 Mar 2011, 05:26 AM
Hi,

I had implemented my own UI for managing the RadRichTextBox control.  Unfortunately upon updating to the latest version of your library I am now getting compile errors as you have changed the signature of the ShowDialog method.

From:
public void ShowDialog(string text, string address, Action<Hyperlink> insertHyperlinkCallback, Action cancelCallback)

To:
ShowDialog(string text, HyperlinkInfo currentHyperlinkInfo, IEnumerable<string> bookmarkNames, Action<string, HyperlinkInfo> insertHyperlinkCallback, Action cancelCallback)

I haven't been able to find any documentation on these changes and what is required in order to get hyperlinks working again with the new contracts.  Could you point me in the right direction please?

Stephen.

5 Answers, 1 is accepted

Sort by
0
Ivailo Karamanolev
Telerik team
answered on 22 Mar 2011, 10:21 AM
Hi Stephen,

These changes are related to the new way we're handling hyperlinks and the support for bookmarks. I'll explain the new signature argument by argument
  • HyperlinkInfo currentHyperlinkInfo - this is the HyperlinkInfo of the current hyperlink. This class (HyperlinkInfo) contains all the information about a hyperlink - the URI, the target and whether it's pointing to a bookmark inside the document or not.
  • IEnumerable<string> bookmarkNames - this is an enumerable of the names of the bookmarks in the current document. The default implementation uses them to provide a combo box for creating links to bookmarks.
  • Action<string, HyperlinkInfo> - the same as before, but using HyperlinkInfo instead of Hyperlink.
The documentation for the new version is still in progress, but we're working to make it available as soon as possible. Let us know if you need any additional information.
Best wishes,
Ivailo
the Telerik team
0
Jarred Froman
Top achievements
Rank 1
answered on 11 Apr 2011, 09:27 PM
We would like to disable/hide certain parts of this dialog and make some of the properties defaulted.  Is that possible?  If not, do you have a sample demonstrating how to use the InsertHyperlinkDialog property?

Thank You,
-Jarred Froman
0
Iva Toteva
Telerik team
answered on 14 Apr 2011, 04:26 PM
Hello Stephen,

Currently there is no way to hide or disable parts of the insert hyperlink dialog. However it is relatively easy to create and use your own dialog by implementing the new slightly changed IInsertHyperlinkDialog interface. I've attached a sample project that demonstrate this. You can use it in your project and customize or remove all the parts you want.
You can see that in the example the MyInsertHyperlinkDialog class has the CustomInsertHyperlink attribute. This way the rich text box will automatically detect it using MEF and will show an instance of this dialog when you call the ShowInsertHyperlinkDialog method.
The other way to replace the default hyperlink dialog is to explicitly set the InsertHyperlinkDialog property of the RadRichTextBox control to an instance of your custom dialog. In this case you don't need to add CustomInsertHyperlink attribute to your implementation of the dialog.

I hope this was helpful. Don't hesitate to write to us again if you need further assistance.

Best wishes,
Alexander
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Vinicius
Top achievements
Rank 1
answered on 01 Feb 2012, 10:03 PM
Hi!
Im having the same problem because the Hyperlink Dialog works fine with web URL and bookmarks, but when i try to create a File hyperlink it always insert "http://" before the address, and try to open it in browser. There's any way to fix it?
0
Iva Toteva
Telerik team
answered on 03 Feb 2012, 03:28 PM
Hi Vinicius,

You can change the fact that the dialog adds http:// before URLs which do not specify another protocol. You can see how this has been done in the attached project in this forum thread or the ones in the WPF forum (there are demos in VB for both Silverlight and WPF and a demo in C# for WPF).

However, even if you insert a hyperlink pointing to a file/folder on the machine, clicking this link will not open the file/folder. An InvalidOperationException will occur, because Silverlight does not allow access to the file system on the client. You can test that by inserting a hyperlink through the API like this:

HyperlinkInfo hyperlinkInfo = new HyperlinkInfo() { NavigateUri = filePath, Target = HyperlinkTargets.Blank };
this.radRichTextBox.InsertHyperlink(hyperlinkInfo, "My File");

I hope this helps. Kind regards,
Iva Toteva
the Telerik team

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

Tags
RichTextBox
Asked by
Stephen
Top achievements
Rank 1
Answers by
Ivailo Karamanolev
Telerik team
Jarred Froman
Top achievements
Rank 1
Iva Toteva
Telerik team
Vinicius
Top achievements
Rank 1
Share this question
or