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

RadRichTextBox error with htmlformatprovider

3 Answers 139 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Iron
Richard asked on 12 Jun 2017, 11:02 PM

Hello.

I have built a perfectly functional usercontrol, which includes a radrichtextbox with htmldataprovider (pretty nice, pretty easy, works like a charm).

Now I need to expose it to some VB6 client :-/, so as I have done before, I just host it in a winforms form, add some COM interfaces, and it should work all the same (been there, done that...)

 

Well, no...

It keeps giving me this error:

Value cannot be null. Parameter name: formatProvider

at Telerik.Windows.Documents.FormatProviders.DataProviderBase..ctor(ITextBasedDocumentFormatProvider formatProvider, DependencyProperty stringProperty)
at Telerik.Windows.Documents.FormatProviders.Html.HtmlDataProvider..ctor()
at System.Xaml.Schema.XamlTypeInvoker.DefaultCtorXamlActivator.InvokeDelegate(Action`1 action, Object argument)
at System.Xaml.Schema.XamlTypeInvoker.DefaultCtorXamlActivator.CallCtorDelegate(XamlTypeInvoker type)
at System.Xaml.Schema.XamlTypeInvoker.DefaultCtorXamlActivator.CreateInstance(XamlTypeInvoker type)
at System.Xaml.Schema.XamlTypeInvoker.CreateInstance(Object[] arguments)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstanceWithCtor(XamlType xamlType, Object[] args)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstance(XamlType xamlType, Object[] args)

 

I tried:

        <telerik:HtmlFormatProvider x:Key="HtmlFormatProvider" />

    <telerik:HtmlDataProvider RichTextBox="{Binding ElementName=SocialHistoriesHtml}" FormatProvider="{StaticResource HtmlFormatProvider}" Html="{Binding HTML}" />

3 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
Iron
answered on 12 Jun 2017, 11:03 PM

Sorry. Wrong button.

 

As I said, I tried that code, but still it doesn't like it when is called from winforms...

 

The release is apr 2015 Q 1. 

 

Thanks in advance.

0
Accepted
Tanya
Telerik team
answered on 15 Jun 2017, 09:03 AM
Hi Richard,

The format providers in RadRichTextBox are loaded by the MEF. Its default implementation uses the application path to find the .exe but in this scenario seems like something is preventing the MEF from loading properly. You can circumnavigate this by creating the TypeCatalog needed for RadRichTextBox manually, before the loading of the control. How to implement this is shown in the MEF topic.

Hope this is helpful.

Regards,
Tanya
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
0
Richard
Top achievements
Rank 1
Iron
answered on 23 Jun 2017, 07:51 PM

Thank you Tanya!

It seems that was the issue...

Tags
RichTextBox
Asked by
Richard
Top achievements
Rank 1
Iron
Answers by
Richard
Top achievements
Rank 1
Iron
Tanya
Telerik team
Share this question
or