This works fine
<TextBlock Name="textBlock1" TextWrapping="Wrap">
<Bold>TextBlock</Bold> is designed to be <Italic>lightweight</Italic>,
and is geared specifically at integrating <Italic>small</Italic> portions
of flow content into a UI.
</TextBlock>
But I need the inner text to be a data binding to a string
Is this even possible ? I tried different things but I cannot make it work
<TextBlock Text="{Binding FormattedText}" TextWrapping="Wrap">
</TextBlock>
this does not work either
<TextBlock TextWrapping="Wrap">
<Run Text="{Binding FormattedText}"/>
</TextBlock>
the Code behind is this:
public string FormattedText
{
get { return _formattedText; }
set
{
_formattedText = value;
OnPropertyChanged(nameof(FormattedText));
}
}
private string _formattedText;
public MyWpfClass()
{
this.InitializeComponent();
FormattedText = "<Bold>TextBlock</Bold> is designed to be <Italic>lightweight</Italic>, and is geared specifically at integrating<Italic>small</Italic> portions of flow content into a UI.";
}
How can I get formatted text with code behind data binding ?
(The text needs to be a string, not a programmable initialization of a TextBlock)
Thanks for your help
thanks for your help
1