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

RadRichTextBox Conditional Formatting

1 Answer 116 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Pratham
Top achievements
Rank 1
Pratham asked on 06 Nov 2014, 12:07 PM
Hi,
 
I have RadRichTextBox on my WPF Window. I am using MVVM design pattern and have binding in my View for this RadRichTextBox using TxtDataProvider as below:

<Window.DataContext>
        <local:vmRichTextBox />
    </Window.DataContext>
    <Grid>
        <telerik:RadRichTextBox x:Name="rchTextBox" Width="210" Height="150">
        </telerik:RadRichTextBox>
        <telerik:TxtDataProvider RichTextBox="{Binding ElementName= rchTextBox}"  Text="{Binding Path= MessageToSend, Mode= TwoWay, UpdateSourceTrigger= PropertyChanged}"></telerik:TxtDataProvider>
    </Grid>

Here Binding works perfect. Now, I would like the user to enter 120 characters only in above RadRichTextBox in a manner  that whenever user enters 121st character the foregoround color of this character and exceeding characters changes to Red while typing itself. The first 120 characters will have default  foreground color.
Please let me know how to implement this functionality with this RadRichTextBox in MVVM asap.

Thanks

1 Answer, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 11 Nov 2014, 12:10 PM
Hi Pratham,

I'm afraid I am unable to recommend a way to achieve the desired behavior in an MVVM scenario. While it is possible to determine which are the last N characters in the control and execute actions over them, the fact that the control is bound with a plain-text provider will strip all formatting you apply.

Let me know if you have other questions.

Regards,
Petya
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
RichTextBox
Asked by
Pratham
Top achievements
Rank 1
Answers by
Petya
Telerik team
Share this question
or