IInsertHyperlinkDialog Changed

6 posts, 0 answers
  1. Stephen
    Stephen avatar
    45 posts
    Member since:
    Jul 2010

    Posted 18 Mar 2011 Link to this post


    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.

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

    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?

  2. Ivailo Karamanolev
    Ivailo Karamanolev avatar
    276 posts

    Posted 22 Mar 2011 Link to this post

    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,
    the Telerik team
  3. Jarred Froman
    Jarred Froman avatar
    57 posts
    Member since:
    Aug 2008

    Posted 11 Apr 2011 Link to this post

    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
  4. Iva Toteva
    Iva Toteva avatar
    1319 posts

    Posted 14 Apr 2011 Link to this post

    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,
    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
  5. Vinicius
    Vinicius avatar
    9 posts
    Member since:
    Dec 2011

    Posted 01 Feb 2012 Link to this post

    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?
  6. Iva Toteva
    Iva Toteva avatar
    1319 posts

    Posted 03 Feb 2012 Link to this post

    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 >>

Back to Top