Hi, telerik guys!
I want to change the Hyperlink Style when I use the RadRichTextBox.InsertHyperlink method, I've created a custom style (see code below) and passed as a parameter to this method instead of the CurrentEditingStyle, but still the text is shown in color blue and underlined, there's any way to change this style and show an specific hyperlink with a custom style? Thanks in advance for the help.
Example Code:
Telerik.Windows.Documents.Model.Styles.StyleDefinition mergeFieldStyle = new Telerik.Windows.Documents.Model.Styles.StyleDefinition();
mergeFieldStyle.BasedOn = radRichTextBox.DefaultStyleSettings.BasedOn;
mergeFieldStyle.BasedOnName = radRichTextBox.DefaultStyleSettings.BasedOnName;
mergeFieldStyle.Type = radRichTextBox.DefaultStyleSettings.Type;
mergeFieldStyle.DisplayName = "MergeFieldStyle";
mergeFieldStyle.Name = "MergeFieldStyle";
mergeFieldStyle.SetPropertyValue(Telerik.Windows.Documents.Model.Span.ForeColorProperty, Colors.Red);
mergeFieldStyle.SetPropertyValue(Telerik.Windows.Documents.Model.Span.UnderlineDecorationProperty, Telerik.Windows.Documents.UI.TextDecorations.DecorationProviders.UnderlineTypes.None);
radRichTextBox.Document.StyleRepository.Add(mergeFieldStyle);
radRichTextBox.InsertHyperlink(mergeField, string.Format("[{0}]", caption), mergeFieldStyle);
I've also try to change the SpanProperties in the CurrentEditingStyle and passing them to the method, with my custom style properties but no success either.
I want to change the Hyperlink Style when I use the RadRichTextBox.InsertHyperlink method, I've created a custom style (see code below) and passed as a parameter to this method instead of the CurrentEditingStyle, but still the text is shown in color blue and underlined, there's any way to change this style and show an specific hyperlink with a custom style? Thanks in advance for the help.
Example Code:
Telerik.Windows.Documents.Model.Styles.StyleDefinition mergeFieldStyle = new Telerik.Windows.Documents.Model.Styles.StyleDefinition();
mergeFieldStyle.BasedOn = radRichTextBox.DefaultStyleSettings.BasedOn;
mergeFieldStyle.BasedOnName = radRichTextBox.DefaultStyleSettings.BasedOnName;
mergeFieldStyle.Type = radRichTextBox.DefaultStyleSettings.Type;
mergeFieldStyle.DisplayName = "MergeFieldStyle";
mergeFieldStyle.Name = "MergeFieldStyle";
mergeFieldStyle.SetPropertyValue(Telerik.Windows.Documents.Model.Span.ForeColorProperty, Colors.Red);
mergeFieldStyle.SetPropertyValue(Telerik.Windows.Documents.Model.Span.UnderlineDecorationProperty, Telerik.Windows.Documents.UI.TextDecorations.DecorationProviders.UnderlineTypes.None);
radRichTextBox.Document.StyleRepository.Add(mergeFieldStyle);
radRichTextBox.InsertHyperlink(mergeField, string.Format("[{0}]", caption), mergeFieldStyle);
I've also try to change the SpanProperties in the CurrentEditingStyle and passing them to the method, with my custom style properties but no success either.