Q1 2013 Release breaks functionality

4 posts, 0 answers
  1. Jonathan Boylan
    Jonathan Boylan avatar
    7 posts
    Member since:
    Nov 2008

    Posted 18 Apr 2013 Link to this post

    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:

    <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?
  2. Petya
    Admin
    Petya avatar
    975 posts

    Posted 22 Apr 2013 Link to this post

    Hi Jonathan,

    We are not sure what exactly might be the problem, so can you please share some additional information with us?

    Please, try subscribing to the ImportException event of the data provider in order to see if and what exception is raised (from the event arguments) and get back to us with the results. You can also try importing content in the RadRichTextBox in your application directly using the HtmlFormatProvider.Import() method. Any other information you feel is relevant will also be appreciated.

    I'm awaiting your reply.

    Regards,
    Petya
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. Jonathan Boylan
    Jonathan Boylan avatar
    7 posts
    Member since:
    Nov 2008

    Posted 22 Apr 2013 Link to this post

    Hi Petya,

    I subscribed to the ImportException event and I seem to be getting a nullreferenceexception (see attached).

    I also used the HtmlFormatProvider.Import() function to generate a RadDocument when my service returns the HTML to display. I then set the RichTextBox control's Document property to this generated document. In this case the HTML now displays perfectly, but it's a bit of a convoluted way to do it as I now have to have a reference to the RichTextBox control in the view model.
  5. Petya
    Admin
    Petya avatar
    975 posts

    Posted 23 Apr 2013 Link to this post

    Hello Jonathan,

    Thank you for getting back to us with those additional details!

    We are unaware what exactly might cause the observed behavior and will highly appreciate if you can open a support ticket and attach a sample project that demonstrates the issue. This way we will be able to troubleshoot on our end and faster pinpoint the problem.

    Thank you for your cooperation!

    Regards,
    Petya
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top