Hello,
I'm having a problem implementing the HtmlDataProvider in my Silverlight project: Here's the error:
The type 'HtmlDataProvider' was not found because 'clr-namespace:Telerik.Windows.Documents.FormatProviders.Html;assembly=Telerik.Windows.Documents.FormatProviders.Html' is an unknown namespace. [Line: 52 Position: 147]
the way I use it:
My namespace definition:
Thanks for any help :)
I'm having a problem implementing the HtmlDataProvider in my Silverlight project: Here's the error:
The type 'HtmlDataProvider' was not found because 'clr-namespace:Telerik.Windows.Documents.FormatProviders.Html;assembly=Telerik.Windows.Documents.FormatProviders.Html' is an unknown namespace. [Line: 52 Position: 147]
the way I use it:
<
telerik:RadRichTextBox
x:Name
=
"RichTextBox"
>
<
telerikDocumentsHtml:HtmlDataProvider
x:Key
=
"HtmlProvider2"
RichTextBox
=
"{Binding ElementName=RichTextBox}"
Html
=
"{Binding Body, Mode=TwoWay}"
/>
<
telerik:RadDocument
LayoutMode
=
"Flow"
>
</
telerik:RadDocument
>
</
telerik:RadRichTextBox
>
My namespace definition:
xmlns:telerikDocumentsHtml="clr-namespace:Telerik.Windows.Documents.FormatProviders.Html;assembly=Telerik.Windows.Documents.FormatProviders.Html"
Thanks for any help :)
5 Answers, 1 is accepted
0
Julien
Top achievements
Rank 1
answered on 03 Jun 2011, 07:51 PM
Hello,
I made some progress and don't have the error anymore. THough I have another one now:
Error 1 A value of type 'HtmlDataProvider' cannot be added to a collection or dictionary of type 'UIElementCollection'. C:\Sources\C2\C2E5\Main\Src\ITIL\ITIL.Views.Silverlight\Views\ManageNoteView.xaml 61 45 ITIL.Views.Silverlight
Any hints of why I can't do that?
I made some progress and don't have the error anymore. THough I have another one now:
Error 1 A value of type 'HtmlDataProvider' cannot be added to a collection or dictionary of type 'UIElementCollection'. C:\Sources\C2\C2E5\Main\Src\ITIL\ITIL.Views.Silverlight\Views\ManageNoteView.xaml 61 45 ITIL.Views.Silverlight
<Grid x:Name="LayoutRoot"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <local:NoteRibbonBarView /> <telerikHtml:HtmlFormatProvider x:Name="HtmlProvider" ></telerikHtml:HtmlFormatProvider>
0
Accepted
Hi Julien,
Please refer to this article on data providers for the right way to declare Data Providers in XAML. Basically, they must be added in the visual tree and not embedded in the RadRichTextBox control itself. You also don't need to add tags for RadDocument, as a Document will be created for the RichTextBox either way by the data provider.
Data providers inherit from FrameworkElement in the versions of the controls starting from Q1 2011, so there shouldn't be a problem to add them in an UIElementCollection. If you are using an older version of the controls, however, this would not be possible.
I have also noticed that in the code snippet that you have declared an HtmlFormatProvider. That produces the error you have cited, as HtmlFormatProviders are not FrameworkElements and are meant to be used in code-behind for "manual" export and import of documents.
Please see below the revised version of your first code-snippet:
I hope this helps.
Kind regards,
Iva
the Telerik team
Please refer to this article on data providers for the right way to declare Data Providers in XAML. Basically, they must be added in the visual tree and not embedded in the RadRichTextBox control itself. You also don't need to add tags for RadDocument, as a Document will be created for the RichTextBox either way by the data provider.
Data providers inherit from FrameworkElement in the versions of the controls starting from Q1 2011, so there shouldn't be a problem to add them in an UIElementCollection. If you are using an older version of the controls, however, this would not be possible.
I have also noticed that in the code snippet that you have declared an HtmlFormatProvider. That produces the error you have cited, as HtmlFormatProviders are not FrameworkElements and are meant to be used in code-behind for "manual" export and import of documents.
Please see below the revised version of your first code-snippet:
<
telerik:RadRichTextBox
x:Name
=
"RichTextBox"
/>
<
telerikDocumentsHtml:HtmlDataProvider
RichTextBox
=
"{Binding ElementName=RichTextBox}"
Html
=
"{Binding Body, Mode=TwoWay}"
/>
Kind regards,
Iva
the Telerik team
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 Public Issue Tracking
system and vote to affect the priority of the items
0
Julien
Top achievements
Rank 1
answered on 06 Jun 2011, 01:49 PM
Thanks a lot, it does seem to work now! =)
0
Viktor
Top achievements
Rank 1
answered on 30 Nov 2011, 11:17 AM
Hi Julien,
How did you fix your original problem "The type 'HtmlDataProvider' was not found because 'clr-namespace:Telerik.Windows.Documents.FormatProviders.Html;assembly=Telerik.Windows.Documents.FormatProviders.Html' is an unknown namespace"?
Thank you.
Viktor
How did you fix your original problem "The type 'HtmlDataProvider' was not found because 'clr-namespace:Telerik.Windows.Documents.FormatProviders.Html;assembly=Telerik.Windows.Documents.FormatProviders.Html' is an unknown namespace"?
Thank you.
Viktor
0
Hello Viktor,
Iva Toteva
the Telerik team
Could you check if you have added a reference to Telerik.Windows.Documents.FormatProviders.Html assembly? This seems the most probable reason for the behavior you are observing.
You can refer to this article for more information on the use of data providers.
Iva Toteva
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>