This is a migrated thread and some comments may be shown as answers.
Binding RichTextBox in Book
3 Answers 21 Views
This is a migrated thread and some comments may be shown as answers.
o
Top achievements
Rank 2
o asked on 15 Sep 2013, 04:41 PM

Helooo,

I have RadBook that contain richtextbox that I want to Bind data to,

My Book Data Template is :

<DataTemplate x:Key  ="LeftPageTemplate"   >
           <StackPanel Margin="10" Background="Azure" >
           <Viewbox Name="ViewSura" Stretch="Fill"        StretchDirection="Both"          FlowDirection="RightToLeft"
                 HorizontalAlignment="Left" Width="450"  Margin="525,21,0,0" Height="600" VerticalAlignment="Top">
               <RichTextBox FontSize="22" MaxWidth ="450" MaxHeight ="600"   Name="richTextBox1"
                            Document ="{Binding FLD}" VerticalAlignment="Top"
                            Background="Brown"  FontStretch="Condensed"
                            FontFamily="KFGQPC Uthmanic Script HAFS" >
                   <RichTextBox.Resources>
                       <Style TargetType="Run">
                           <EventSetter Event="MouseLeftButtonDown"  />
                       </Style>
                   </RichTextBox.Resources>
               </RichTextBox >
           </Viewbox>
       </StackPanel>
       </DataTemplate>

In in my code Page XML File:

<Window.Resources>
       <ResourceDictionary>
           <ResourceDictionary.MergedDictionaries>
               <ResourceDictionary Source="Dictionary1.xaml"></ResourceDictionary>
           </ResourceDictionary.MergedDictionaries>
       </ResourceDictionary>
   </Window.Resources>
   <Grid>
   <telerik:RadBook x:Name="RadBook1"
                    Margin="50"
                    LeftPageTemplate="{StaticResource LeftPageTemplate}"
                    RightPageTemplate="{StaticResource RightPageTemplate}" />

In in my C# code I did this:

ObservableCollection<RTBI > MyPages= new ObservableCollection<RTBI>();
        
          for (int i = 0; i < 10; i = i + 1)
          {
              ReadSura rs = new ReadSura();
 
              MyPages.Add(new RTBI()
              {
                  FLD = rs.readsuratxt(i + 1) //  This is to get the Flow document ..
              });
          }
          RadBook1.ItemsSource = MyPages ;
      }

Put I get the error for binding, please what am I doing wrong. Please see the attached image for error details.

Please Help.

Regards...


3 Answers, 1 is accepted

Sort by
0
o
Top achievements
Rank 2
answered on 16 Sep 2013, 03:08 PM
Any help Please....
0
Accepted
Petya
Telerik team
answered on 18 Sep 2013, 02:48 PM
Hello,

RadRichTextBox's Document property is not a DependencyProperty so binding such as the one you've implemented is not possible. For the purpose of data binding documents to the editor Data Providers are exposed. 

Further, in order to bind to Items controls RadDocumentBindingSource was introduced. There is also a corresponding RichTextPageViewPresenter. You can see how they work in one of RadRichTextBox's click-once demos RadBook Integration as well as in the attached sample project.

Note that the integration between the two controls has some known issues, however at this point they are not scheduled.

I hope this helps!

Regards,
Petya
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
o
Top achievements
Rank 2
answered on 18 Sep 2013, 03:52 PM
Many Thanks,

Unfortunately I do not have the 2010 release which do not have the new features.

Best Regards,
Omar
Tags
Book
Asked by
o
Top achievements
Rank 2
Answers by
o
Top achievements
Rank 2
Petya
Telerik team
Share this question
or