¿Cómo puedo cambiar el color de fondo del texto seleccionado en el cuadro de texto enriquecido wpf c #
¿Cómo puedo mostrar el texto html enRichTextBox
¿controlar?
En realidad quiero cambiar el color de fondo del texto seleccionado enRichTextBox
en C # wpf. Probé este código pero no muestra el texto con formato.
Por favor, ayúdame ... Gracias de antemano!
void rtbTextEditor_SelectionChanged(object sender, RoutedEventArgs e)
{
SelectionText = rtbTextEditor.Selection.Text.Trim();
if (SelectionText != string.Empty)
{
if (VisualEditor.Document.Body != null)
{
//VisualEditor is web browser
VisualEditor.Document.Body.InnerHtml = @"""<html><body><FONT style=""BACKGROUND-COLOR: #ffff00""><bold>""" + rtbTextEditor.Selection.Text + @"""</Bold></FONT></body></html>""";
VisualEditor.Document.ExecCommand("SelectAll", false, null);
rtbTextEditor.Document.Blocks.Add(new Paragraph(new Run(VisualEditor.Document.Body.InnerText.ToString())));
}
}
}