Two way Binding not working on second hit

5 posts, 1 answers
  1. Tanuj
    Tanuj avatar
    5 posts
    Member since:
    Sep 2011

    Posted 19 Oct 2011 Link to this post

    We are having RadRichTextBox in a user control and my user control is never disposed (means RadRichtextBox also),only visiblity of user control is toggled and we change the data inside usercontrol, every time
    Now during first run, control gets intialised and data comes into radRichTextbox and goes out to binded poperty very well

    Problem comes in second time, when same user contol is visible again with different set of data, radRichTextbox show same old value
    I have tried clearing value, history everything and raisingPorpertyChange events explictly but nothing is working

    Can you please help
  2. Boby
    Admin
    Boby avatar
    685 posts

    Posted 24 Oct 2011 Link to this post

    Hello Tanuj,
    Could you please provide more details on how you bind RadRichTextBox? Do you use our data providers? You can also open a support ticket and send us attached runnable sample project that reproduces the issue, so we can investigate it further.
    Looking forward to your reply.

    Regards,
    Boby
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. Tanuj
    Tanuj avatar
    5 posts
    Member since:
    Sep 2011

    Posted 24 Oct 2011 Link to this post

    I am using RADRichTextBox without Ribbon Bar and with HTML data provider, and using it like this

    <telerik1:RadRichTextBox Grid.Row="8" Grid.Column="1" Grid.ColumnSpan="3" TabIndex="2"
                                                     IsContextMenuEnabled="True" IsSelectionMiniToolBarEnabled="True" IsSpellCheckingEnabled="True"
                                                     LayoutMode="Flow"  Margin="0" Name="txtdetails" MinHeight="15" BorderThickness="0"
                                                     VerticalAlignment="Stretch" DocumentInheritsDefaultStyleSettings="False"
                                                     Padding="0" MouseOverBorderThickness="0">
                                <telerik1:RadRichTextBox.Resources>
                                    <RadHTMLDataProvider:HtmlDataProvider x:Key="HTMLDataProvider" RichTextBox="{Binding ElementName=txtdetails}" Html="{Binding Details,Mode=TwoWay,ValidatesOnDataErrors=True,NotifyOnValidationError=True}"></RadHTMLDataProvider:HtmlDataProvider>
                                </telerik1:RadRichTextBox.Resources>
                            </telerik1:RadRichTextBox>
  4. Answer
    Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 27 Oct 2011 Link to this post

    Hello Tanuj,

    As noted in this article, the data providers have to be in the visual tree, because otherwise their context is not properly updated.

    In a nutshell, the change that you have to rewrite your XAML like this:

    <telerik1:RadRichTextBox Grid.Row="8" Grid.Column="1" Grid.ColumnSpan="3" TabIndex="2" IsContextMenuEnabled="True" IsSelectionMiniToolBarEnabled="True" IsSpellCheckingEnabled="True" LayoutMode="Flow" Margin="0" Name="txtdetails" MinHeight="15" BorderThickness="0" VerticalAlignment="Stretch" DocumentInheritsDefaultStyleSettings="False" Padding="0" MouseOverBorderThickness="0" />
    <RadHTMLDataProvider:HtmlDataProvider x:Name="HTMLDataProvider" RichTextBox="{Binding ElementName=txtdetails}" Html="{Binding Details,Mode=TwoWay,ValidatesOnDataErrors=True,NotifyOnValidationError=True}" />

    You don't have to worry about the place in the visual tree where the provider is, as it does not have a visual representation.

    Regards,
    Iva Toteva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  5. Tanuj
    Tanuj avatar
    5 posts
    Member since:
    Sep 2011

    Posted 27 Oct 2011 Link to this post

    Thanks Iva it does solves the problem partially
    Let me scratch my head for remaining part, will ping you again if required :)

    -Tanuj
Back to Top