HtmlFormatProvider in RadTabControl

2 posts, 0 answers
  1. Michael
    Michael avatar
    1 posts
    Member since:
    Nov 2013

    Posted 15 Apr Link to this post

    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>
  2. Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 20 Apr Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top