I am trying to supplant some of the language in my WPF application, however I would like to use some degree of formatting as well.
My initial thought was to use a string resource that represented a FlowDocument or Paragraph, for example:
<FlowDocument>
<Paragraph FontSize="16" Foreground="Blue">Some display text under content management</Paragraph>
</FlowDocument>
In the user interface, I am trying to bind this using IValueConverter:
<ContentControl Content="{Binding Path=CMSText,Source={StaticResource Resources},Converter={StaticResource flowDocConverter}"/>
In the converter:
StringReader sr = new StringReader(value.ToString());
XamlReader xamlReader = XamlReader.Create(sr);
return (FlowDocument)xamlReader.Parse();
but it continues to throw an exception in the return statement.
Is it possible to do this through binding?
And where am I mistaken in XamlReader?
EDIT
XamlParseException
"Unable to create unknown type" FlowDocument ". Line number" 1 "and line position" 2 ".
source
share