Back to Devexpress

ContentToPlainTextConverter Class

wpf-devexpress-dot-xpf-dot-richedit-ebdde160.md

latest3.7 KB
Original Source

ContentToPlainTextConverter Class

A Content-to-text converter associated with a binding.

Namespace : DevExpress.Xpf.RichEdit

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

NuGet Package : DevExpress.Wpf.RichEdit

Declaration

csharp
[ValueConversion(typeof(RichEditDocumentContent), typeof(string))]
public class ContentToPlainTextConverter :
    ContentToSpecificFormatConverter
vb
<ValueConversion(GetType(RichEditDocumentContent), GetType(String))>
Public Class ContentToPlainTextConverter
    Inherits ContentToSpecificFormatConverter

Remarks

The ContentToPlainTextConverter implements the IValueConverter interface. Use the ContentToPlainTextConverter class to convert the control’s content to plain text format.

The following code snippet binds standard TextControl to the RichEditControl using the ContentToPlainTextConverter class.

A BarManager component enables the hover menu.

View Example: How to implement a converter to bind RichEditControl to the text in different formats

xaml
<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>

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ContentToPlainTextConverter class.

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.

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

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

Inheritance

Object ContentToSpecificFormatConverter ContentToPlainTextConverter

See Also

ContentToPlainTextConverter Members

DevExpress.Xpf.RichEdit Namespace