Customize InsertHyperlinkDialog using the "CustomInsertHyperlinkDialog"-Sample

3 posts, 0 answers
  1. Thomas
    Thomas avatar
    2 posts
    Member since:
    Sep 2015

    Posted 15 Sep 2015 Link to this post


    at the moment I am evaluating the Telerik Richtextbox and I want to use it in my Light​Switch​-Application.
    Everything works fine so far and now I want to customize the InsertHyperlinkDialog to my purpose.

    Therefore I have downloaded the sample "CustomInsertHyperlinkDialog" from your website.
    Then I added the two files InsertHyperlinkDialog.xaml and InsertHyperlinkDialog.xaml.cs to my Silverlight "SilverlightControls" where the RichTextBox is located.
    Then I have changed the namespace of InsertHyperlinkDialog.xaml.cs to Silverlightcontrols and I have also changed the x:Class in InsertHyperlinkDialog.xaml to x:Class="SilverlightControls.InsertHyperlinkDialog"

    What to I have to do that my custom window is used instead of the standard window?
    I have tried to use the code provided in the sample within radRichTextBox_HyperlinkClicked: this.radRichTextBox.Commands.ShowInsertHyperlinkDialogCommand.Execute();
    But this seems to do nothing.
    And I have also tried to create a new instance of InsertHyperlinkDialog:
    InsertHyperlinkDialog hyperDialog = new InsertHyperlinkDialog();
    When I try this, my custom dialog and the standard dialog are going to be opened.
    And nothing happens when I try to Insert an ​hyperlink using my custom control.

    What do I have to do to make this work?

  2. Thomas
    Thomas avatar
    2 posts
    Member since:
    Sep 2015

    Posted 15 Sep 2015 in reply to Thomas Link to this post

    I have tried to make this work all day. But it just ​won´t work.
    It always opens the original Dialog when I call "this.radRichTextBox.Commands.ShowInsertHyperlinkDialogCommand.Execute();"
    I cant figure out ​where the RichTextBox is told to open the custom Dialog and not the original one?
    I am using [CustomInsertHyperlink] within "InsertHyperlinkDialog.xaml.cs" but this code never gets executed.
    When I use the example it is executed when I call "this.radRichTextBox.Commands.ShowInsertHyperlinkDialogCommand.Execute"​. But why not in my Solution? Do I need more files than "InsertHyperlinkDialog.xaml.cs" and "InsertHyperlinkDialog.xaml" to use a custom ​Dialog? Or is there a Problem to use a custom Dialog inside Lightswitch?

  3. Tanya
    Tanya avatar
    891 posts

    Posted 17 Sep 2015 Link to this post

    Hi Thomas,

    Most probably the reason for this behavior is that the MEF cannot properly load the necessary types due to cached data in LightSwitch. You could try to set your custom dialog to the RadRichTextBox
    this.radRichTextBox.InsertHyperlinkDialog = new CustomInsertHyperlinkDialog();

    or change the TypeCatalog to use the new dialog instead of the default InsertHyperlinkDialog. For more information about Managed Extensibility Framework and the TypeCatalog you could refer to the MEF article in our documentation.

    Hope this helps.

    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 Feedback Portal and vote to affect the priority of the items
Back to Top