I am trying to format parts of the text something like 'this is test'. where parts of the string are bold and in italic. I get the string as a collection of words {word1, word2, word3......}
<Button Command="{Binding MyCommand}" CommandParameter="{Binding Text, ElementName=MyTextBlock}">
<TextBlock src:TextHelper.FormattedText="{Binding ListOfWords}" Name="MyTextBlock"/>
And in the helper i am parsing through the collection of words and i am setting the inline with the formatting which is working fine i.e. i see the correctly formatted text on the UI
textBlock.Inlines.Add(span);
But when the button is clicked the first time i don't get any value because the text property of the text block is empty.
I came across a similar question
Read C# Textblock Text Property filled using Inlines
But I cannot use loaded method. Is there some way to get the value of text and pass to the command ?