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...