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

Detecting Bulleted and Numbered

8 Answers 151 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Karlkim Suwanmongkol
Top achievements
Rank 1
Karlkim Suwanmongkol asked on 03 Dec 2010, 06:17 PM
From the code, I can toggle some buttons like bold, italic, or subscript by checking the appropriated Style's property values. However, I could not figure out where to check if the highlighted text have been bulleted or numbered. Could you point me where I could find the information?

Thanks,
Karlkim

8 Answers, 1 is accepted

Sort by
0
Accepted
Boby
Telerik team
answered on 07 Dec 2010, 02:12 PM
Hello Karlkim Suwanmongkol,
The easiest way to update buttons' states is to handle the events that each of the RadRichTextBox's commands raises.
  • This could be the XAML, here you bind buttons to appropriate commands:
    <telerik:RadToggleButton x:Name="bulletListButton" Command="{Binding ElementName=richTextBox, Path=Commands.ToggleBulletsCommand}" ...
    </telerik:RadToggleButton >
    <telerik:RadToggleButton x:Name="numberedListButton" Command="{Binding ElementName=richTextBox, Path=Commands.ToggleNumberedCommand}" ...
    </telerik:RadToggleButton >
  • and this - the code behind. Here you handle command's event to update the state of the control:
    public MainPage()
    {
        InitializeComponent();
      
        this.richTextBox.Commands.ToggleBulletsCommand.ToggleExecuted += (s, e) => { this.bulletListButton.IsChecked = e.NewValue; };
        this.richTextBox.Commands.ToggleNumberedCommand.ToggleExecuted += (s, e) => { this.numberedListButton.IsChecked = e.NewValue; };
    }
The same approach could be used with other buttons too.
Don't hesitate to contact us if you have other questions.

Regards,
Boby
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Karlkim Suwanmongkol
Top achievements
Rank 1
answered on 07 Dec 2010, 03:59 PM
Hi Boby,
   I am sorry for the confusion. Actually, what I want is to be able to detect if the highlighted text is numbered or bulleted or not, so I could toggle the buttons on the fly. Here is the example that I find for "Bold", http://www.telerik.com/help/silverlight/radrichtextbox-features-working-with-radrichtextxbox.html#Current_Span.

I would like to do the similar thing for bulleted and numbered.

Thanks,
karlkim
0
Boby
Telerik team
answered on 09 Dec 2010, 12:04 PM
Hi Karlkim Suwanmongkol,
The value of the CurrentEditingStyle doesn't fit your needs, because it only shows the style under the current position, and not for the whole selection. For example, if you select 2 words, one of them bold and one not, CurrentEditingStyle will report bold or not, depending in which word current position is.
The easiest way to implement the correct behavior in this case is the one I outlined previously. Actually this is what we use behind the scenes in RadRichTextBoxRibbonUI - as you can read here. We will consider extending the approach specified in the help article you refer for the next realease.

Please get back to us if this doesn't help.

Kind regards,
Boby
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Sasireka
Top achievements
Rank 1
answered on 20 Jun 2013, 01:21 PM
Hi Boby,

I am also need to apply bullets and numbering to rich text box. I tried the below way but i am getting error as "does not contain a definition of ToggleExecuted" And i am having only "ToggleStateChanged" event. Could you please guide on how to avoid this issue also which namespace we have to use for this.


Regards,
Sasireka
0
Boby
Telerik team
answered on 21 Jun 2013, 05:59 AM
Hi Sasireka,
This thread is rather old. The approach is described in this help article.

Regards,
Boby
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Sasireka
Top achievements
Rank 1
answered on 21 Jun 2013, 07:06 AM
Hi Boby,

I got it. Thank you so much for your help.

Regards,
Sasireka
0
Sasireka
Top achievements
Rank 1
answered on 21 Jun 2013, 07:09 AM
Hi Boby,

I got it. Thank you so much for your help. :)

Regards,
Sasireka
0
Sasireka
Top achievements
Rank 1
answered on 04 Jul 2013, 10:22 AM
Hi Boby,

We are using Rad rich text box with bullets and numbering format. The bullets and numbering format not copied by using Ctrl + A and Ctrl + V.
Steps to replicate issue:
1. select the numbering text  by using Ctrl + A.
2. Press on Ctrl + X
3. Then press on Ctrl + V. Now the control displayed only the text not displayed the numbering / bullet format.

I want to display the format also like ms word doc.. Please share if any code available..

Regards,
Sasireka
Tags
RichTextBox
Asked by
Karlkim Suwanmongkol
Top achievements
Rank 1
Answers by
Boby
Telerik team
Karlkim Suwanmongkol
Top achievements
Rank 1
Sasireka
Top achievements
Rank 1
Share this question
or