Back to Devexpress

RichEditControl.BarManager Property

wpf-devexpress-dot-xpf-dot-richedit-dot-richeditcontrol-1e5ba14b.md

latest5.3 KB
Original Source

RichEditControl.BarManager Property

Gets or sets the main component that provides the Bars functionality. This is a dependency property.

Namespace : DevExpress.Xpf.RichEdit

Assembly : DevExpress.Xpf.RichEdit.v25.2.dll

NuGet Package : DevExpress.Wpf.RichEdit

Declaration

csharp
public BarManager BarManager { get; set; }
vb
Public Property BarManager As BarManager

Property Value

TypeDescription
BarManager

A BarManager object.

|

Remarks

The BarManager specifies the container for bars and popup menus. Use this property to enable bar or Ribbon interface of DXRichEdit control.

The BarManager should be initialized when binding it to the RichEditControl. To create bars dynamically, unlink the RichEditControl from BarManager, add the required bars and a bar item and then link RichEditControl to this BarManager, as shown in the code snippet below:

csharp
//Unlink the BarManager from the RichEditControl
var barManager = richEditControl1.BarManager;
richEditControl1.BarManager = null;

 //Create new bar items
var bar = new Bar() { Caption = "New Item" };
bar.DockInfo.ContainerType = BarContainerType.Top;
bar.ShowDragWidget = false;
barManager.Bars.Add(bar);
var item = new BarButtonItem();
item.Command = RichEditUICommand.EditCut;
item.CommandParameter = richEditControl1;
bar.ItemLinks.Add(item);
barManager.Items.Add(item);

//Bind the BarManager to the RichEditControl
richEditControl1.BarManager = barManager;
vb
'Unlink the BarManager from the RichEditControl
Dim barManager = richEditControl1.BarManager
richEditControl1.BarManager = Nothing

'Create new bar items
Dim bar = New Bar() With {.Caption = "New Item"}
bar.DockInfo.ContainerType = BarContainerType.Top
bar.ShowDragWidget = False
barManager.Bars.Add(bar)
Dim item = New BarButtonItem()
item.Command = RichEditUICommand.EditCut
item.CommandParameter = richEditControl1
bar.ItemLinks.Add(item)
barManager.Items.Add(item)

'Bind the BarManager to the RichEditControl
 richEditControl1.BarManager = barManager

The following code snippets (auto-collected from DevExpress Examples) contain references to the BarManager property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

dxrichedit-for-wpf-how-to-print-a-document-as-a-series-of-images/CS/SaveAsImage/MainWindow.xaml#L47

xml
</dxr:RibbonControl>
    <dxre:RichEditControl x:Name="richEditControl1" BarManager="{Binding ElementName=barManager1, Mode=OneTime}" Ribbon="{Binding ElementName=ribbonControl1, Mode=OneTime}" Loaded="richEditControl1_Loaded" />
</DockPanel>

wpf-richedit-embed-a-live-chart-into-a-document/CS/RichEdit_InsertChart/MainWindow.xaml#L43

xml
</dxr:RibbonControl>
    <dxre:RichEditControl Name="richEditControl1" BarManager="{Binding ElementName=barManager1, Mode=OneTime}" Ribbon="{Binding ElementName=ribbonControl1, Mode=OneTime}" CalculateDocumentVariable="richEditControl1_CalculateDocumentVariable" />
</DockPanel>

wpf-rich-text-editor-customize-context-menu/CS/ContextMenuCustomization/MainWindow.xaml#L38

xml
<dxre:RichEditControl x:Name="richEdit" CommandBarStyle="Empty" BarManager="{Binding ElementName=barManager1, Mode=OneTime}" PopupMenuShowing="RichEditPopupMenuShowing">
    <dxre:RichEditControl.MenuCustomizations>

wpf-richedit-bind-richeditcontrol-to-text-in-different-formats/CS/BindingConverter/MainWindow.xaml#L20

xml
<dxre:RichEditControl x:Name="richEditControl1" Height="Auto" Width="Auto"
                   BarManager="{Binding ElementName=barManager1}" ActiveViewType="Simple" />
</dxb:BarManager>

See Also

RichEditControl Class

RichEditControl Members

DevExpress.Xpf.RichEdit Namespace