Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
FormWPF()
{
// Create a FlowDocument
                FlowDocument mcFlowDoc = new FlowDocument();
                // Create a paragraph with text
                Paragraph para = new Paragraph();
                para.Inlines.Add(new Run("Text me ? "));
                para.Inlines.Add(new Bold(new Run("Test Bold")));
                // Add the paragraph to blocks of paragraph
                mcFlowDoc.Blocks.Add(para);
   RichTextEditor rd = new RichTextEditor();
  rd.Document = mcFlowDoc;  // got error does not contain definition for Document
}

xaml code for RichTextEditor

HTML
<stackpanel>
 <richtextbox name="mainRTB" acceptstab="True" height="500" width="900">
  asis:RichTextboxAssistant.BoundDocument="{Binding Path=Text, ElementName=uxRichTextEditor}"
                            VerticalScrollBarVisibility="Visible" />
               <!--<textbox text="{Binding Path=Text, ElementName=uxRichTextEditor}" height="25" />-->
           </richtextbox></stackpanel>
Posted
Updated 11-Mar-12 21:18pm
v3

1 solution

You are gettin confused between ASP's RichTextEditor and WPF's RichTextBox. In this line
C#
RichTextEditor rd = new RichTextEditor();
  rd.Document = mcFlowDoc;  // got error does not contain definition for Document
you are creating a RichTextEditor, which does not have a Document property, instead of a RichTextBox, which does.
 
Share this answer
 
Comments
palanirajan 12-Mar-12 3:45am    
Hi , Thanks,

RichTextEditor is nothing but a richText box created in xaml Code
How can add Document property to this?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900