We're using the RichTextBox in our product in read-only mode for displaying T&Cs in a pop-up window. However, since the upgrade from 2012 Q3 to 2013 Q1, this has stopped working. We do use Prism, and this is the code that used to work:
XAML for the pop-up window:
The Html property of the HtmlDataProvider is bound to a member in the viewmodel and set from a service call. However, even if the HtmlHelp member is set explicitly in code with some test html string, it still doesn't work. The binding seems to be working, but the richtextbox isn't displaying the content.
Any ideas what maight have changed in this release?
XAML for the pop-up window:
<
controls:ChildWindow
x:Class
=
"Project.UI.Common.Views.TermsAndConditionsDialog"
xmlns:controls
=
"clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
Height
=
"480"
Width
=
"640"
HasCloseButton
=
"True"
>
<
Grid
x:Name
=
"LayoutRoot"
Margin
=
"2"
>
<
Grid.RowDefinitions
>
<
RowDefinition
/>
<
RowDefinition
Height
=
"Auto"
/>
</
Grid.RowDefinitions
>
<
Grid
Grid.Row
=
"0"
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
></
RowDefinition
>
<
RowDefinition
></
RowDefinition
>
</
Grid.RowDefinitions
>
<
Border
Grid.Row
=
"0"
>
<
TextBlock
VerticalAlignment
=
"Center"
FontSize
=
"28"
FontFamily
=
"{StaticResource TitleFontFace}"
>Terms & Conditions</
TextBlock
>
</
Border
>
<
telerik:RadRichTextBox
x:Name
=
"richTextBoxTerms"
Grid.Row
=
"1"
Margin
=
"0,10,0,0"
IsReadOnly
=
"True"
IsSpellCheckingEnabled
=
"False"
Background
=
"White"
>
</
telerik:RadRichTextBox
>
<
telerik:HtmlDataProvider
x:Name
=
"HtmlProvider"
Grid.Row
=
"1"
Html
=
"{Binding HtmlHelp, Mode=OneWay}"
RichTextBox
=
"{Binding ElementName=richTextBoxTerms}"
/>
</
Grid
>
</
Grid
>
</
controls:ChildWindow
>
The Html property of the HtmlDataProvider is bound to a member in the viewmodel and set from a service call. However, even if the HtmlHelp member is set explicitly in code with some test html string, it still doesn't work. The binding seems to be working, but the richtextbox isn't displaying the content.
public
class
TermsAndConditionsDialogViewModel : ViewModelBase
{
private
readonly
IHelpServiceAgent _helpServiceAgent;
public
TermsAndConditionsDialogViewModel(IUnityContainer container,
ITermsAndConditionsDialog view)
:
base
(container, view)
{
_helpServiceAgent = Container.Resolve<IHelpServiceAgent>();
// Get the Terms and Conditions text
_helpServiceAgent.GetHelpForModule(
"terms"
, a => LoadTermsCompleted(a));
}
public
string
_htmlHelp;
public
string
HtmlHelp
{
get
{
return
_htmlHelp; }
set
{
if
(_htmlHelp != value)
{
_htmlHelp = value;
OnPropertyChanged(() => HtmlHelp,
true
);
}
}
}
private
void
LoadTermsCompleted(Dtos.Help.HelpDto helpDto)
{
if
(helpDto !=
null
&& !
string
.IsNullOrEmpty(helpDto.Content))
{
HtmlHelp = helpDto.Content;
}
}
}
Any ideas what maight have changed in this release?