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

Binding by RtfDataProvider

1 Answer 197 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
MuxMux
Top achievements
Rank 1
MuxMux asked on 01 Nov 2011, 03:03 PM
Hello!
I am trying to load a .rtf document in the RadRichTextBox using bindings in XAML.
Here is my XAML:
<UserControl.DataContext>
    <DutyRegulations:DutyRegulationsViewModel/>
</UserControl.DataContext>
  
<UserControl.Resources>
    <DataTemplate x:Key="TabContentTemplate">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <telerik:RadRichTextBox x:Name="radRichTextBox" IsReadOnly="True" Grid.Column="0" Width="500" Height="500"/>
            <Rtf:RtfDataProvider Rtf="{Binding FileSource}"  RichTextBox="{Binding ElementName=radRichTextBox}"/>
        </Grid>
    </DataTemplate>
</UserControl.Resources>
     
<Grid>
    <telerik:RadTabControl HorizontalAlignment="Stretch" Name="radTabControl" VerticalAlignment="Stretch" ItemsSource="{Binding Path=StaffDutyRegulations}" DisplayMemberPath="Staff.Name" ContentTemplate="{StaticResource TabContentTemplate}"/>
</Grid>
What type should be the object that is bound to the "Rtf" property of RtfDataProvider? Can I pass an array of bytes? Can I do it without any code-behind? I can see in the output that my code always throws an exception : "A first chance exception of type 'System.NullReferenceException' occurred in Telerik.Windows.Documents.dll". Thank you in advance. 

Sincerely yours,
Mike.

1 Answer, 1 is accepted

Sort by
0
MuxMux
Top achievements
Rank 1
answered on 02 Nov 2011, 09:41 AM
Well, I solved the problem already. One should always declare a dataprovider before the richtextbox.

Sincerely yours,
Mike.
Tags
RichTextBox
Asked by
MuxMux
Top achievements
Rank 1
Answers by
MuxMux
Top achievements
Rank 1
Share this question
or