Derives from Control

The RichTextBoxFormatBar is a contextual formtting toolbar that mimics the behavior of the Microsoft Office 2010 formatting bar. It can be attached to any Richtextbox control by using the RichTextBoxFormatBarManager. You can even create your own formatting bar and use it instead, but still have all the functionality the RichTextboxFormatBarManager provides.



The RichTextBoxFormatBar is a contextual text formatting toolbar that will apply text transformations to the selected text of a RichTextBox control. When the user is in the process of a selection, the RichTextBoxFormatBar will appear when the mouse is released after the selection. The RichTextBoxFormatBar will also appear during the last click of a "double-click" selection. While the RichTextFormatBar is shown, you may click on any number of text transformations to be applied to the selected text. When done, you may click anywhere else in the RichTextBox control or move your mouse outside of the RichTextBox control to hide the RichTextBoxFormatBar. You can also drag the RichTextBoxFormatBar to a different position if it shows in a position that is not desired by clicking and holding on the drag thumb and moving your mouse to the desired location.



You can add the RichTextBoxFormatBar to either the toolkit's RichTextBox or the default Windows RichTextBox. This is done by using the RichTextBoxFormatBarManager. You simply set the RichTextBoxFormatBarManager.FormatBar property to the desired IRichTextBoxFormatBar instance. The following snippet addsthe RichTextBoxFormatBar to the Entended WPF Toolit's RichTextBox.

           <xctk:RichTextBoxFormatBar />

The following snippet addsthe RichTextBoxFormatBar to the default Windows RichTextBox.

           <xctk:RichTextBoxFormatBar />

Create Your Own Format Bar

You create your own custom format bar by creating a custom/user control that implements the IRichTextBoxFormatBar interface and set the RichTextBoxFormatBarManager.FormatBar property to your new custom format bar instance.

           <local:MyCustomFormatBar />


Property Description
FontSizes Gets an array of font sizes.
Target Gets or sets the target RichTextBox.


Method Description
PreventDisplayFadeOut Returns true if the RichTextBoxFormatBar is in a non-fading state.
Update Updates the RichTextBoxFormatBar.

Support this project, check out the Plus Edition.

Last edited Jun 1, 2016 at 2:52 PM by dlafontaine, version 13


BoucherS Mar 1, 2016 at 7:28 PM 

Try something like this :
<xctk:RichTextBox Margin="5"
<xctk:RichTextBoxFormatBar />
<Paragraph>This is the
<Bold>RichTextBox</Bold> !

ColeSpolaric Mar 1, 2016 at 7:02 PM 
I am unable to get this to display in my wpf application. This needs much better documentation.

BoucherS Jan 6, 2014 at 1:10 PM 
Hi, Please use the Discussions Tab to submit ideas. The bug refering to focus/deactivation in RichTextFormatBar will be fixed in v2.1.

John3983 Jan 3, 2014 at 6:59 PM 
This component is a great idea! Please can you try and fix the problems with focus/deactivation when using the keyboard or mouse. For example: try opening the size combo and selecting 34 with the mouse or try clicking in a combo box and using the up or down keys.

Many thanks.

Pavithra Apr 22, 2013 at 6:17 AM 

We are using Richtextcontrol in our project, and
we are facing few issues with Richtext formatbar.

1) If we enter text with line space and then if we do bulleting/Numbering then line space are also bulleted.

2)for bulleting/Numbering Text if change the alignment only text will be alligne not the bulleting.

3)All font changes (Font, Color & Background color) goes off, while selecting text with different background color, font size, text color.

Please let us know how to fix these issues or any workaround.


Farawin Jul 2, 2012 at 12:16 PM 
Very nice. I have a question though:
I'm trying to style the Extended WPF Toolkit RichTextBox like so:

<Style TargetType="{x:Type tk:RichTextBox}">
<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="SpellCheck.IsEnabled" Value="True"/>
<Setter Property="tk:RichTextBoxFormatBarManager.FormatBar" Value="{x:Type tk:RichTextBoxFormatBar}"/>
However at runtime it fails with a ArgumentNullException saying: "Value cannot be null. Parameter name: property".

What could be causing this behaviour?

I also tried this syntax:

<Style TargetType="{x:Type tk:RichTextBox}">
<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="SpellCheck.IsEnabled" Value="True"/>
<Setter Property="tk:RichTextBoxFormatBarManager.FormatBar">
<tk:RichTextBoxFormatBar />
Unfortunately it gave me the same exception.

marshalsea Oct 24, 2011 at 2:07 PM 
Thanks for the RTF Text box and this.
Found this for adding the toolbar programmatically, which could be useful to others:

Microsoft.Windows.Controls.RichTextBox rtb_wording = new Microsoft.Windows.Controls.RichTextBox();
Microsoft.Windows.Controls.RichTextBoxFormatBar formatBar = new Microsoft.Windows.Controls.RichTextBoxFormatBar();
Microsoft.Windows.Controls.RichTextBoxFormatBarManager.SetFormatBar(rtb_wording, formatBar); //Static method on the BarManager

LisaTatum Nov 19, 2010 at 12:58 PM 
Nice nice nice, this shows quality and a real Office 2010 Format Bar!