This is a migrated thread and some comments may be shown as answers.

Transition with ReadOnly RadRichTextBox

1 Answer 73 Views
TransitionControl
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 11 Apr 2012, 05:57 PM

I am using a RadRichTextBox as a Rich Content Viewer. (WPF 40)

What is the correct way to Bind TransitionControl with fadeEffect to a read-only RadRichTextBox (RRTB) control?

There is no user input in this process. (Remote display only)

The RadRichTextBox is loaded from Database with Html from code behind on a seperate thread every 5 seconds.  

Is there an example of binding RRTB Data Context to transition, or an example of binding a RRTB Data Template to transition?

Because it’s Read-only, How do I bind the changing Data (with HtmlFormatProvider or RRTB directly)

 Or is there a strictly XAML way to bind with declaratives?

I am trying to keep this as simple as possible.

What do I have to do to the following code to add Fade Transition to RadRichTextBox1?

 

The XAML:

<telerik:RadRichTextBox  x:Name="RadRichTextBox1"

    IsReadOnly="True"

    IsEnabled="True"

    IsSelectionEnabled="False"

    IsFocusable="False"

    HorizontalAlignment="Left"

    VerticalAlignment="Top"

    Height="595"

    Width="1050"

    Margin="20,122,0,0">

</telerik:RadRichTextBox>

 

VB - Code Behind Snippet:

            Dim HtmlMsg as String= MSG_TXT.ToString                             ‘  load  HTML from DB

 

             Me.RadRichTextBox1.IsSpellCheckingEnabled = False

             Me.RadRichTextBox1.Document = Me.htmlFormatProvider.Import(HtmlMsg)    

1 Answer, 1 is accepted

Sort by
0
Ivailo Karamanolev
Telerik team
answered on 17 Apr 2012, 09:35 AM
Hi,

Here's a short code example that can get you started with TransitionControl and RadRichTextBox:
This can be replaced with your own model/data class:
    public class Model : INotifyPropertyChanged
    {
        private string myProperty;
 
        public string MyProperty
        {
            get
            {
                return this.myProperty;
            }
            set
            {
                this.myProperty = value;
                if (this.PropertyChanged != null)
                {
                    this.PropertyChanged(this, new PropertyChangedEventArgs("MyProperty"));
                }
            }
        }
 
        public event PropertyChangedEventHandler PropertyChanged;
    }
 
And this is the XAML you need:
        <telerik:RadTransitionControl Content="{Binding}">
            <telerik:RadTransitionControl.Transition>
                <telerikTransition:FlipWarpTransition />
            </telerik:RadTransitionControl.Transition>
            <telerik:RadTransitionControl.ContentTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <telerik:RadRichTextBox telerikHtml:HtmlDataProvider.Source="{Binding Path=MyProperty, Mode=TwoWay}" />
                        <TextBox Grid.Row="1" Text="{Binding Path=MyProperty, Mode=TwoWay}" />
                    </Grid>
                </DataTemplate>
            </telerik:RadTransitionControl.ContentTemplate>
        </telerik:RadTransitionControl>
When changing the property, you should not change the value, but rather the entire object TransitionControl is bound to.
Let us know if you need further assistance.

Regards,
Ivailo Karamanolev
the Telerik team

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

Tags
TransitionControl
Asked by
Dan
Top achievements
Rank 1
Answers by
Ivailo Karamanolev
Telerik team
Share this question
or