Displaying rtf in RadRichTextBox in LightSwitch Project

4 posts, 0 answers
  1. Jean Marie
    Jean Marie avatar
    3 posts
    Member since:
    Jan 2011

    Posted 10 Apr 2013 Link to this post

    Hi,
    I have a LightSwitch 2012 project in which I added a Silverlight project to include the Telerik RadRichTextBox as a custom control to display text that is stored as RTF data in the database.
    My control has the following xaml:

    <UserControl
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="Kbc.Msi.UserControls.InterfaceTechnicalDescriptionViewer"
        xmlns:rtfProvider="clr-namespace:Telerik.Windows.Documents.FormatProviders.Rtf;assembly=Telerik.Windows.Documents.FormatProviders.Rtf"
        mc:Ignorable="d"
        d:DesignHeight="600" d:DesignWidth="800">
     
        <Grid x:Name="LayoutRoot" Background="White">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <telerik:RadRichTextBox x:Name="radRichTextBox"
                                    BorderBrush="{x:Null}"
                                    Margin="0"
                                    IsReadOnly="False"
                                    AcceptsTab="False"
                                    LayoutMode="Flow"
                                    Grid.Row="0" Grid.Column="0"
                                    VerticalScrollBarVisibility="Auto">
                <telerik:RadRichTextBox.Resources>
                    <rtfProvider:RtfDataProvider x:Key="provider" x:Name="Provider"
                                                 RichTextBox="{Binding ElementName=radRichTextBox}"
                                                 Rtf="{Binding Path=Content, Mode=TwoWay}" />
                </telerik:RadRichTextBox.Resources>
            </telerik:RadRichTextBox>
        </Grid>
    </UserControl>

     

    The control is added on a LightSwitch details screen and bound to a text property that contains text stored as rtf.
    For some reason however the control is showing perfectly on the screen, but no data is shown in the control.
    I know data is present, because for debugging purposes I've added a text control to show the data as plain text.
    Is there something I'm missing here?

  2. Jean Marie
    Jean Marie avatar
    3 posts
    Member since:
    Jan 2011

    Posted 11 Apr 2013 Link to this post

    Might be that we found the issue.
    It looks like the rtf text (imported automatically through an SSIS package) has a space in front of the rtf formatted text, which is causing the issue. I'll verify once I get a new import file without the extra space to see if this was the issue...
  3. DevCraft banner
  4. Boby
    Admin
    Boby avatar
    595 posts

    Posted 12 Apr 2013 Link to this post

    Hi Jean Marie,
    You can also use RtfDataProvider.ImportException event for troubleshooting the exceptions during the import process.
    If the problem can be reproduced with valid RTF document, we would like to send it to us for further investigation.

    Kind regards,
    Boby
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  5. Jean Marie
    Jean Marie avatar
    3 posts
    Member since:
    Jan 2011

    Posted 13 Apr 2013 Link to this post

    Thanks for the tip, will make sure to try that out, but I'm pretty sure that the root cause of the issue is an invalid file format.
    Once we get to try with a valid document I will update this post.
Back to Top