I am trying to externalise some of the wording within my WPF application, however I would like to be able to use some degree of formatting as well.
My initial thought was to use a string resource which represented a FlowDocument or Paragraph such as:
<FlowDocument>
<Paragraph FontSize="16" Foreground="Blue">Some display text under content management</Paragraph>
</FlowDocument>
In the UI I have been trying to bind this using a 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 keeps throwing an exception on the return statement.
Is it even possible to do this via a binding?
And where am I going wrong in the XamlReader?
EDIT
XamlParseException
'Cannot create unknown type 'FlowDocument'.' Line number '1' and line position '2'.