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

HtmlFormatProvider in RadTabControl

1 Answer 52 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 15 Apr 2016, 10:52 PM
Hi,

 

I am trying to get a series of tab RichTextEditors to return formatted text as html markup fragments, and not the fully-qualified HTML doc.  We use this same RichTextEdit elsewhere which honors the formatting settings to return fragments (but not in a tab control), but in the context below, it always returns the default full html doc no matter what.  Originally this was using a resource dictionary, but I inlined the HTMLDataProvider to try to isolate the problem

 
<telerik:RadTabControl Style="{DynamicResource TabControlNoHeaderBackground}" ItemsSource="{Binding Disclosures}">
    <telerik:RadTabControl.ItemTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding DisclosureTypeName}" />
        </DataTemplate>
    </telerik:RadTabControl.ItemTemplate>
    <telerik:RadTabControl.ContentTemplate>
        <DataTemplate>
            <Grid>
                <telerik:HtmlDataProvider x:Name="CustomerHtmlDataProvider"
                                          Html="{Binding Content, Mode=TwoWay}"
                                          RichTextBox="{Binding ElementName=TxtDisclosureContent}">
                    <telerik:HtmlDataProvider.FormatProvider>
                        <telerik:HtmlFormatProvider>
                            <telerik:HtmlFormatProvider.ExportSettings>
                                <telerik:HtmlExportSettings
                                    DocumentExportLevel="Fragment"
                                    ImageExportMode="None"
                                    ExportFontStylesAsTags="True"
                                    ExportStyleMetadata="False">
                                </telerik:HtmlExportSettings>
                            </telerik:HtmlFormatProvider.ExportSettings>
                        </telerik:HtmlFormatProvider>
                    </telerik:HtmlDataProvider.FormatProvider>
                </telerik:HtmlDataProvider>
                <telerik:RadRichTextBox x:Name="TxtDisclosureContent" IsSpellCheckingEnabled="False" />
            </Grid>
        </DataTemplate>
    </telerik:RadTabControl.ContentTemplate>
</telerik:RadTabControl>

1 Answer, 1 is accepted

Sort by
0
Mihail
Telerik team
answered on 20 Apr 2016, 04:39 PM
Hello Michael,

We made some tests to find the source of this issue and it turns out that it is a WPF problem.  In particular, DataTemplate may reset local values set to the dependency property.
The solution is to use a user control in your data template.

I hope this information is helpful for you.

Regards,
Mihail
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
RichTextBox
Asked by
Michael
Top achievements
Rank 1
Answers by
Mihail
Telerik team
Share this question
or