From 9d3dcc5eebb30c613eea16def942b12937d2f032 Mon Sep 17 00:00:00 2001 From: DianeXceed Date: Wed, 21 Jun 2017 14:54:15 -0400 Subject: [PATCH] Updated RichTextBox (markdown) --- RichTextBox.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/RichTextBox.md b/RichTextBox.md index f866546..487121c 100644 --- a/RichTextBox.md +++ b/RichTextBox.md @@ -1,7 +1,7 @@ # RichTextBox Derives from System.Windows.Controls.RichTextBox -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:* "
This is the RichTextBox
" ### 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. Example: