![](/forums/images/avatarimages/default.gif)
I see in the xaml markup of the RadRibbonButton:
telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ShowInsertHyperlinkDialogCommand}"
I'm assuming this ShowInsertHyperlinkDialogCommand is in the Telerik assembly. Do you have suggestions for accomplishing the requirements mentioned above? Thanks
19 Answers, 1 is accepted
All UI that RadRichTextBox uses - dialogs, context menu, selection mini toolbar, etc., are loaded by MEF and can be substituted for others.
What you need to do in order to accomplish this is to implement the IInsertHyperlinkDialog and add the [CustomInsertHyperlinkDialog] attribute to your implementation. Please find attached a project illustrating how this can be done. In the example, I have included the default InsertHyperlinkDialog and used it as a custom one.
Iva Toteva
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
![](/forums/images/avatarimages/default.gif)
I have converted the C# example, but I'm getting:
"CustomInsertHyperlinkDialog' must implement 'Sub ShowDialog(text As String, currentHyperlinkInfo As Model.HyperlinkInfo, bookmarkNames As System.Collections.Generic.IEnumerable(Of String), insertHyperlinkCallback As System.Action(Of String, Model.HyperlinkInfo), cancelCallback As System.Action)' for interface 'Telerik.Windows.Documents.UI.Extensibility.IInsertHyperlinkDialog'"
Even though I have the following in the code:
Public Sub ShowDialog(text As String, currentHyperlinkInfo As Model.HyperlinkInfo, bookmarkNames As System.Collections.Generic.IEnumerable(Of String), insertHyperlinkCallback As System.Action(Of String, Model.HyperlinkInfo), cancelCallback As System.Action)
The method must be declared as follows:
Public
Overloads
Sub
ShowDialog(text
As
String
, currentHyperlinkInfo
As
HyperlinkInfo, bookmarkNames
As
IEnumerable(Of
String
), insertHyperlinkCallback
As
Action(Of
String
, HyperlinkInfo), cancelCallback
As
Action, owner
As
RadRichTextBox)
Implements
IInsertHyperlinkDialog.ShowDialog
Me
.ShowDialogInternal(text, currentHyperlinkInfo, bookmarkNames, insertHyperlinkCallback, cancelCallback, owner)
End
Sub
Please find attached the demo converted to VB.
Greetings,
Iva Toteva
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
![](/forums/images/avatarimages/default.gif)
I'm also trying to do this in Silverlight.
Thanks
Tony
I assumed the sample you needed was for WPF, since this is the WPF forum.
Please find attached the same demo for Silverlight.
Greetings,
Iva Toteva
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
![](/forums/images/avatarimages/default.gif)
<telerik:RadComboBox ItemsSource="{Binding Source={StaticResource DataSource}, Path=Folders}" DisplayMemberPath="FolderName"
Grid.Row="5" x:Name="FolderComboBox" HorizontalAlignment="Left" VerticalAlignment="Center" Width="180"
Grid.Column="1" SelectedIndex="0" SelectionChanged="FolderComboBox_SelectionChanged">
</telerik:RadComboBox>
and in the code behind:
private void FolderComboBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
string s = "";
}
Again, when the selectionchanged event is not included in the xaml, the dialog opens fine. Please provide suggestions on why it is behaving this way, or let me know if you need to see the entire project. I have simply added my controls to the sample project you sent and will be happy to upload the entire solution. Thanks.
![](/forums/images/avatarimages/default.gif)
![](/forums/images/avatarimages/fe6669ae-f2b5-4ae3-b174-32f5d01f23edhellraiser.png)
I've try the solution you attached to the post, and it let me customize the dialog just fine. But the link inserted into the textbox control by this line:
insertHyperlinkCallback(hyperlinkText, hyperlinkInfo) It doesn't serve to my purposes
Is there any way to implement this callback by myself?, because I need to create my own a href tag, adding some extra values
thanks
It is not possible to change the callback that the editor uses to insert hyperlinks in the editor.
If you would like to achieve some other behavior, you can implement another command and wire your UI to work with it. When it comes to the changes you have mentioned, could you elaborate more on your scenario?
Iva Toteva
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
![](/forums/images/avatarimages/fe6669ae-f2b5-4ae3-b174-32f5d01f23edhellraiser.png)
First thank you for your quick response. Our scenario is like this: we use the Editor to create some email templates, in those templates we add specific elements to some specific tags, in the case of "a href" tag, this added elements let us, in a later process, to match data from the database and execute some task base on the click to those links. We call'em "trackable links" cause when the user click on them in the template, he get redirected to some URL which count the "hit" and redirects the user to the original link.
But since there's no way to change/implement this callback, could we insert data to the editor directly from this dialog? I'm thinking maybe we can add a checkbox and modify the behavior on the Ok button depending on the checkbox been checked or not, if is checked then "inject" our customized link directly to the editor, if is not the execute the behavior as it is now? it's possible?
thanks again for you helping hand
best regards
![](/forums/images/avatarimages/fe6669ae-f2b5-4ae3-b174-32f5d01f23edhellraiser.png)
We decided to resolve this issue with a workaround, creating our own custom value for the href element in the A tag since we have to reprocess it later, that won't be a big problem.
But now we have another issue, we use the example project attached to an earlier reply, but that example uses the Q1 2012 Library, and we are using the Q3 2011 Library in our project because when we try the Q4 2011 we experience some troubles like missing datacontext on some callbacks.
Now it seems, in Q3 2011 Library there's no RadRichTextBoxWindow class in the Telerik.Windows.Controls.RichTextBoxUI.Dialogs namespace or any other namespace
and the CustomInsertHyperlink class can't inherit from it. Should we change this RadRichTextBoxWindow class for another in the Q3 2011 Library?
Migrating to Q1 2011 is not an option for us, cause don't have the time to test the impact of that migration, but we're in need of resolving this CustomInsertHyperlink issue first.
RadRichTextBoxWindow was introduced lately as a base class for all built-in RadRichTextBox dialogs, and for now its only function is to resolve some theme-related issues. In your case you can inherit directly from RadWindow and check if this satisfy your requirements.
Kind regards,
Boby
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
![](/forums/images/avatarimages/fe6669ae-f2b5-4ae3-b174-32f5d01f23edhellraiser.png)
thanks
By default, RadRichTextBox loads the UI it uses - SelectionMiniToolBar, ContextMenu, all dialogs, etc., through MEF. That is why normally adding the respective attribute (e.g. [CustomInsertHyperlinkDialog]) is sufficient to get it working.
However, there are some cases when MEF does not work. In that case, you can simply set the InsertHyperlinkDialog property of RadRichTextBox to a new instance of the custom dialog or follow the approach described in this article.
Iva Toteva
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
![](/forums/images/avatarimages/fe6669ae-f2b5-4ae3-b174-32f5d01f23edhellraiser.png)
I try:
this.radRichTextBox.InsertHyperlinkDialog = new CustomInsertHyperlinkDialog();
and also try with
RadCompositionInitializer.Catalog = new TypeCatalog( typeof(CustomInsertHyperlinkDialog));
In my "test" solution but when I put the files in my project won't work, any Ideas?
We have not encountered such an issue and have no other guesses what could be wrong with your application.
Since the demo attached in one of the previous posts works correctly on your end as well, please try comparing it to your project. You can also open a support ticket and attach your application, so that we can investigate further.
Iva Toteva
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
![](/forums/images/avatarimages/fe6669ae-f2b5-4ae3-b174-32f5d01f23edhellraiser.png)
Finally I could isolate the problem I'm experiencing for some reason, I can't find, after assing the InsertHyperLinkDialog property the value for this property gets change back to the original value. I've decided to implement my own Command and force the display of my CustomInsertHyperlinkDialog.
We don't think that there is a bug in the way the default command handles custom InsertHyperlinkDialogs, especially since it works in the demo we have prepared.
However, as we cannot reproduce the problem and do not know your project in detail, you probably have a better view on what could be wrong and better chances of solving the issue.
All the best,
Iva Toteva
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
![](/forums/images/avatarimages/01ff3823-cfb7-4474-8343-6a2b9d0a26c54tpxtu7eic8r.jpg-80x80.jpg)
I want know how to add this local dialogue window CustomInsertHyperlinkDialog.xaml, as window or as UserControl or what
and what is the procedure to add this as local window.
Thanks
Sopan Vaidya