RichEditControl.Content Property

Gets or sets the control's content. This is a dependency property.

Namespace: DevExpress.Xpf.RichEdit

Assembly: DevExpress.Xpf.RichEdit.v20.1.dll

Declaration

public RichEditDocumentContent Content { get; set; }
Public Property Content As RichEditDocumentContent

Property Value

Type Description
RichEditDocumentContent

A RichEditDocumentContent class instance used to obtain the control's content in different formats.

Remarks

Use the Content property to bind RichEditControl content to HTML, RTF or plain text data. Note that RichEditControl.HtmlText, RichEditControl.RtfText or RichEditControl.Text properties are not dependency properties, so they cannot be used to bind text to the control.

Use a proper converter to bind data to the Content property. The RichEditControl provides the following converters:

The code sample below binds standard TextControl to the RichEditControl using the ContentToPlainTextConverter class.

A BarManager component enables the hover menu.

<Window.Resources>
    <dxre:ContentToPlainTextConverter x:Key="ContentPlainConverter" />
    <dxre:RichEditUICommand x:Key="commands" />
</Window.Resources>

<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition />
        <ColumnDefinition/>
    </Grid.ColumnDefinitions>
    <dxb:BarManager Name="barManager1" Grid.Column="0"> 
                    <dxre:RichEditControl x:Name="richEditControl1"  Height="Auto" Width="Auto" 
                       BarManager="{Binding ElementName=barManager1}" ActiveViewType="Simple" />
    </dxb:BarManager>
    <TextBox Text="{Binding ElementName=richEditControl1, Path=Content, Converter={StaticResource ContentPlainConverter}, Mode=OneWay}" 
        x:Name="textBox1" Grid.Column="1" Height="Auto" Width="Auto"/>
</Grid>
TIP

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E4002.

When binding multiple controls to the same data source, set the RichEditControl.UseDeferredDataBindingNotifications property to false to fire the binding-retaled events at the same time.

TIP

Use the RichEditControl.DocumentSource property to bind the RichEditControl to a document source.

See Also