Extends the System.Windows.Control.RichTextBox control that represents a rich editing control which operates on FlowDocument objects. The RichTextBox control has a Text dependency property which allows a user to data bind content to the RichTextBox.Document property. The RichTextBox control introduces the concept of Text Formatters. Text Formatters allows a user to format the content of the RichTextBox control into any format of their choice. Three Text Formatters are included; PlainTextFormatter, RtfFormatter, and a XamlFormatter. The RtfFormatter is the default Text Formatter. A user can create their own custom Text Formatter by creating a class that inherits from ITextFormatter and implimenting the contract accordlingly.
Extends the System.Windows.Control.RichTextBox control that represents a rich editing control which operates on FlowDocument objects. The RichTextBox control has a Text dependency property which allows a user to data bind content to the RichTextBox.Document property. The RichTextBox control introduces the concept of Text Formatters. Text Formatters allows a user to format the content of the RichTextBox control into any format of their choice. Three Text Formatters are included; PlainTextFormatter, RtfFormatter, and a XamlFormatter. The RtfFormatter is the default Text Formatter. A user can create their own custom Text Formatter by creating a class that inherits from ITextFormatter and implementing the contract accordingly.
* [Usage](#usage)
* [Formatters](#using-formatters)
@ -11,7 +11,6 @@ Extends the System.Windows.Control.RichTextBox control that represents a rich ed
* [Methods](#methods)
### Usage
When data binding to the Text property, you must use the Text Formatter that matches the format of the underlying data. If your data is in RTF you must use the RTF formatter. If your data is in plain text, you must use the PlainTextFormatter.
[[RichTextBox_richtextbox_control.jpg]]
@ -27,7 +26,6 @@ This RichTextBox is bound to an object that has a Notes property. The value of
```
### Using Formatters
To use a different Text Formatter than the default RtfFormatter use the following syntax:
**PlainTextFormatter**
@ -67,7 +65,6 @@ To use a different Text Formatter than the default RtfFormatter use the followin
*Xaml Format:* "<Sectionxmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""xml:space=""preserve""TextAlignment=""Left""LineHeight=""Auto""IsHyphenationEnabled=""False""xml:lang=""en-us""FlowDirection=""LeftToRight""NumberSubstitution.CultureSource=""User""NumberSubstitution.Substitution=""AsCulture""FontFamily=""SegoeUI""FontStyle=""Normal""FontWeight=""Normal""FontStretch=""Normal""FontSize=""12""Foreground=""#FF000000""Typography.StandardLigatures=""True""Typography.ContextualLigatures=""True""Typography.DiscretionaryLigatures=""False""Typography.HistoricalLigatures=""False""Typography.AnnotationAlternates=""0""Typography.ContextualAlternates=""True""Typography.HistoricalForms=""False""Typography.Kerning=""True""Typography.CapitalSpacing=""False""Typography.CaseSensitiveForms=""False""Typography.StylisticSet1=""False""Typography.StylisticSet2=""False""Typography.StylisticSet3=""False""Typography.StylisticSet4=""False""Typography.StylisticSet5=""False""Typography.StylisticSet6=""False""Typography.StylisticSet7=""False""Typography.StylisticSet8=""False""Typography.StylisticSet9=""False""Typography.StylisticSet10=""False""Typography.StylisticSet11=""False""Typography.StylisticSet12=""False""Typography.StylisticSet13=""False""Typography.StylisticSet14=""False""Typography.StylisticSet15=""False""Typography.StylisticSet16=""False""Typography.StylisticSet17=""False""Typography.StylisticSet18=""False""Typography.StylisticSet19=""False""Typography.StylisticSet20=""False""Typography.Fraction=""Normal""Typography.SlashedZero=""False""Typography.MathematicalGreek=""False""Typography.EastAsianExpertForms=""False""Typography.Variants=""Normal""Typography.Capitals=""Normal""Typography.NumeralStyle=""Normal""Typography.NumeralAlignment=""Normal""Typography.EastAsianWidths=""Normal""Typography.EastAsianLanguage=""Normal""Typography.StandardSwashes=""0""Typography.ContextualSwashes=""0""Typography.StylisticAlternates=""0""><Paragraph><Run>This is the </Run><RunFontWeight=""Bold"">RichTextBox</Run></Paragraph></Section>"
### Custom Formatters
To create a custom formatter create a class that inherits from ITextFormatter and implement accordingly.
```
@ -98,8 +95,7 @@ Xaml:
```
### Gotchas
When using the RichTextBox with buttons to change the styles of your text such as bold, italics, etc...,; you will notice that the Text is not updated until the control losses focus. Therefore when you leave focus on the RichTextBox and start manipulating test with buttons, those changes will not be propogated property. This is because by default, the source is not update until the RichTextBox control loses focus. To enable this behavior you must set the UpdateSourceTrigger to PropertyChanged on your Text property binding. This will force any change to the text to be updated through data binding to the underlying data source.
When using the RichTextBox with buttons to change the styles of your text such as bold, italics, etc...,; you will notice that the Text is not updated until the control losses focus. Therefore when you leave focus on the RichTextBox and start manipulating test with buttons, those changes will not be propagated property. This is because by default, the source is not update until the RichTextBox control loses focus. To enable this behavior you must set the UpdateSourceTrigger to PropertyChanged on your Text property binding. This will force any change to the text to be updated through data binding to the underlying data source.