| Rockford Lhotka |
Unless I’m missing something, there’s no direct way to bind XAML-ish text to a WinRT
RichTextBlock control.
For example, if I have some text like:
This is some text. And somebolded text .
I would like to just bind this text to a RichTextBlock control for display. Sadly
there’s no way to put content into a RichTextBlock control at runtime
This is some text. And some
short of adding
Block objects to the control’s Blocks collection.
As a workaround, I’ve been playing with the idea of a custom control like this:
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Markup; namespace Application11
{
public class RichTextDisplay : ContentControl
{
public static readonly DependencyProperty XamlProperty =
DependencyProperty.Register("Xaml", typeof(string), typeof(RichTextDisplay), new PropertyMetadata(null, XamlChanged)); public string Xaml...(Read whole news on source site)
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Markup; namespace Application11
{
public class RichTextDisplay : ContentControl
{
public static readonly DependencyProperty XamlProperty =
DependencyProperty.Register("Xaml", typeof(string), typeof(RichTextDisplay), new PropertyMetadata(null, XamlChanged)); public string Xaml...(Read whole news on source site)




