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

Customize InsertHyperlinkDialog using the "CustomInsertHyperlinkDialog"-Sample

2 Answers 70 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 15 Sep 2015, 08:28 AM

Hello,

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();
hyperDialog.ShowDialog();
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 Answers, 1 is accepted

Sort by
0
Thomas
Top achievements
Rank 1
answered on 15 Sep 2015, 03:14 PM

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?
Thanks,
Thomas


0
Tanya
Telerik team
answered on 17 Sep 2015, 03:17 PM
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.

Regards,
Tanya
Telerik
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
Tags
RichTextBox
Asked by
Thomas
Top achievements
Rank 1
Answers by
Thomas
Top achievements
Rank 1
Tanya
Telerik team
Share this question
or