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

Displaying rtf in RadRichTextBox in LightSwitch Project

3 Answers 65 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Jean Marie
Top achievements
Rank 1
Jean Marie asked on 10 Apr 2013, 01:08 PM

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?

3 Answers, 1 is accepted

Sort by
0
Jean Marie
Top achievements
Rank 1
answered on 11 Apr 2013, 07:07 AM
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...
0
Boby
Telerik team
answered on 12 Apr 2013, 07:07 AM
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.

0
Jean Marie
Top achievements
Rank 1
answered on 13 Apr 2013, 04:09 PM
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.
Tags
RichTextBox
Asked by
Jean Marie
Top achievements
Rank 1
Answers by
Jean Marie
Top achievements
Rank 1
Boby
Telerik team
Share this question
or