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

Why is ParagraphChangeStyleCommand internal?

5 Answers 47 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Ben
Top achievements
Rank 1
Ben asked on 09 Dec 2010, 07:06 PM
So I'm in the process of upgrading from Telerik 2010 Q2 to 2010 Q3.  I have a custom paragraph style for type, (like Word Heading1, Heading2, Normal).  This is no longer working because for some reason ParagraphChangeStyleCommand was changed to internal.

Why did they change this?  Is there anyway to extend Paragraph styles like I could in Q2?

5 Answers, 1 is accepted

Sort by
0
Ben
Top achievements
Rank 1
answered on 14 Dec 2010, 03:20 PM
Does anyone have an update on this?  Bump :)
0
Iva Toteva
Telerik team
answered on 15 Dec 2010, 10:24 AM
Hi Ben,

 If you want to change the Paragraph style, you can use the method which RadRichTextBox exposes like this:

StyleDefinition styleInfo;
... // set the values of the properties in styleInfo
radRichTextBox.ChangeParagraphStyle(styleInfo);
Try it out and let us know if that doesn't answer your question.
We changed all commands or RadRocument to internal as they were not very convenient for use. Instead we introduced commands implementing ICommand interface (exposed by RichTextBoxCommands class) and corresponding APIs of RadRichTextBox.

Kind regards,
Iva
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Ben
Top achievements
Rank 1
answered on 15 Dec 2010, 03:34 PM
I've created a custom IStylePropertyDefinition

public class ParagraphType : IStylePropertyDefinition
{
    public static ParagraphType ParagraphTypeProperty = new ParagraphType();
  
    public const string NAME = "ParagraphType";
  
    public void ClearValue(DocumentElement element)
    {
    }
  
    public string PropertyName
    {
        get { return NAME; }
    }
  
    public Type PropertyValueType
    {
        get { return typeof(string); }
    }
  
    public StylePropertyOptions PropertyOptions
    {
        get { return StylePropertyOptions.AffectsLayout; }
    }
}

The ChangeParagraphStyle method only seems to add commands for known StyleDefinitions, not custom ones.
0
Mike
Telerik team
answered on 16 Dec 2010, 04:01 PM
Hi Ben,

Unfortunately ChangeParagraphStyle indeed works for known properties only and there is no workaround for this. Currently we do not have any plans to open the internal document commands API as it is not designed for public usage and we will need time to prepare it if we should make it public. A solution for you would be to build your own version of RadRichTextBox from its source code, that we provide along with a dev license. You can for example add you application to see internal members with InternalsVisibleTo attribute in RadRichTextBox assembly. Please Let us know if you conciser this solution.


Greetings,
Mike
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Ben
Top achievements
Rank 1
answered on 16 Dec 2010, 05:02 PM
Thanks for the update.  That's very disappointing that you would change this to internal in Q3 when it was public in Q2, but I'll do my best to work around it.
Tags
RichTextBox
Asked by
Ben
Top achievements
Rank 1
Answers by
Ben
Top achievements
Rank 1
Iva Toteva
Telerik team
Mike
Telerik team
Share this question
or