Cómo vincular el texto de RichTextArea de xamlEnlace el texto de RichTextBox Xaml
19
A
Respuesta
3
No hay construida en forma de hacerlo. Puede crear propiedad adjunta de texto y vincularla como se describe here
0
Esto no se puede hacer, tiene que actualizarlo manualmente. El documento no es una DependencyProperty.
0
Debería poder suceder en SL4 RC. Ver What is the best substitute for FlowDocument in Silverlight?
3
Aquí está la solución que se me ocurrió. Creé una clase RichTextViewer personalizada y heredó de RichTextBox.
using System.Windows.Documents;
using System.Windows.Markup;
using System.Windows.Media;
namespace System.Windows.Controls
{
public class RichTextViewer : RichTextBox
{
public const string RichTextPropertyName = "RichText";
public static readonly DependencyProperty RichTextProperty =
DependencyProperty.Register(RichTextPropertyName,
typeof (string),
typeof (RichTextBox),
new PropertyMetadata(
new PropertyChangedCallback
(RichTextPropertyChanged)));
public RichTextViewer()
{
IsReadOnly = true;
Background = new SolidColorBrush {Opacity = 0};
BorderThickness = new Thickness(0);
}
public string RichText
{
get { return (string) GetValue(RichTextProperty); }
set { SetValue(RichTextProperty, value); }
}
private static void RichTextPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
{
((RichTextBox) dependencyObject).Blocks.Add(
XamlReader.Load((string) dependencyPropertyChangedEventArgs.NewValue) as Paragraph);
}
}
}
24
que tienen la respuesta más fácil aquí:
Silverlight 4 RichTextBox Bind Data using DataContext y funciona como un encanto.
<RichTextBox>
<Paragraph>
<Run Text="{Binding Path=LineFormatted}" />
</Paragraph>
</RichTextBox>
1
Puede utilizar la clase InlineUIContainer
si desea enlazar un control XAML en el interior de una línea de control mecanografiadas
Cuestiones relacionadas
- 1. Serialización de WPF RichTextBox a XAML frente a RTF
- 2. C# RichTextBox Seleccione especificada texto
- 3. Colorear texto selectivamente en RichTextBox
- 4. Enlace XAML propiedad BitmapImage ViewModel
- 5. XAML TextBlock y Ejecutar enlace
- 6. Enlace a la propiedad ICollectionView.Count en XAML
- 7. WPF RichTextBox anexando texto de color
- 8. WPF richTextBox pregunta
- 9. Cómo alinear texto en RichTextBox C#?
- 10. WPF RichTextBox sin ancho establecido
- 11. Texto para colorear en RichtextBox, C#
- 12. texto Conjunto RTF en el control RichTextBox WPF
- 13. C# ¿Cómo puedo configurar el color del texto en richtextbox?
- 14. Enlace a Self/'esto' en XAML
- 15. Conmutar instrucción (Seleccionar) en enlace Xaml?
- 16. Deshabilitar el desplazamiento automático RichTextBox
- 17. transparente richTextBox
- 18. RichTextBox equivalente de TextBox.AcceptsReturn
- 19. ¿Cómo seleccionar texto de RichTextBox y luego colorearlo?
- 20. C#/WPF: Deshabilitar ajuste del texto de RichTextBox
- 21. WPF RichTextBox SelectionChanged Rendimiento
- 22. ¿Es posible escribir texto en richtextbox en tiempo de diseño?
- 23. RichTextBox y Word
- 24. jQuery: reemplazar el texto dentro del enlace?
- 25. Encuadernación XAML: enlace a las propiedades de un objeto "global"
- 26. C# RichTextBox problema de selección
- 27. .NET RichTextBox deshacer
- 28. El enlace de datos para el cuadro de texto
- 29. Convierta HTML a XAML
- 30. XAML cómo hacer flotar el texto sobre la imagen
El enlace que es específico para WPF. RichTextBox en Silverlight no tiene una propiedad de documento en él. –
Me gustaría hacer un segundo comentario de Steve. –