I have a richTextBox using a htmlDataProvider, however when it starts up the text is blank.
I am able to select the text in the RichTextBox but the text is still blank. I am also able to write in the RichTextBox and the text is still blank.
Here is the code, it's prett simple.
Xaml
<
UserControl
x:Class
=
"RadControlsSilverlightApp1.MainPage"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:docs
=
"clr-namespace:Telerik.Windows.Documents.FormatProviders.Html;assembly=Telerik.Windows.Documents.FormatProviders.Html"
mc:Ignorable
=
"d"
d:DesignWidth
=
"640"
d:DesignHeight
=
"480"
Background
=
"Black"
>
<
UserControl.Resources
>
<
docs:HtmlDataProvider
x:Key
=
"html"
RichTextBox
=
"{Binding ElementName=rtb}"
Html
=
"{Binding html, Mode=TwoWay}"
>
</
docs:HtmlDataProvider
>
</
UserControl.Resources
>
<
Grid
x:Name
=
"LayoutRoot"
>
<
StackPanel
>
<
telerik:RadRichTextBox
x:Name
=
"rtb"
BorderBrush
=
"Black"
BorderThickness
=
"1"
IsSpellCheckingEnabled
=
"False"
/>
<
TextBox
Text
=
"{Binding html,Mode=TwoWay}"
/>
</
StackPanel
>
</
Grid
>
</
UserControl
>
Code Behind
public
partial
class
MainPage : UserControl
{
public
MainPage()
{
InitializeComponent();
this
.DataContext =
this
;
this
.Loaded +=
new
RoutedEventHandler(MainPage_Loaded);
}
void
MainPage_Loaded(
object
sender, RoutedEventArgs e)
{
this
.html =
"Some Text"
;
}
public
string
html
{
get
{
return
(
string
)GetValue(htmlProperty); }
set
{ SetValue(htmlProperty, value); }
}
// Using a DependencyProperty as the backing store for html. This enables animation, styling, binding, etc...
public
static
readonly
DependencyProperty htmlProperty =
DependencyProperty.Register(
"html"
,
typeof
(
string
),
typeof
(MainPage),
null
);
}
I am using version 2010.3.1018.1040
thanks