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

Format Providers namespace issue

5 Answers 174 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Julien
Top achievements
Rank 1
Julien asked on 03 Jun 2011, 03:37 PM
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:

<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

Sort by
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?

 <Grid x:Name="LayoutRoot">
       
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <local:NoteRibbonBarView />
         <telerikHtml:HtmlFormatProvider x:Name="HtmlProvider" ></telerikHtml:HtmlFormatProvider>
0
Accepted
Iva Toteva
Telerik team
answered on 06 Jun 2011, 09:02 AM
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:
<telerik:RadRichTextBox x:Name="RichTextBox" />
<telerikDocumentsHtml:HtmlDataProvider RichTextBox="{Binding ElementName=RichTextBox}" Html="{Binding Body, Mode=TwoWay}" />
I hope this helps.

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
0
Iva Toteva
Telerik team
answered on 02 Dec 2011, 04:30 PM
Hello Viktor,

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.

Best wishes,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
RichTextBox
Asked by
Julien
Top achievements
Rank 1
Answers by
Julien
Top achievements
Rank 1
Iva Toteva
Telerik team
Viktor
Top achievements
Rank 1
Share this question
or