title: XAML Convert textblock text to Inlines
body: <p>I want to set this kind of text on TextBlock in a UWP project :</p>
  
  <pre><code>"&lt;Bold&gt;" + variable + "&lt;/Bold&gt;"
  </code></pre>
  
  <p>But set it to Text value do not consider <code>&lt;Bold&gt;</code> tags.</p>
  
  <p>So i searched how to do and the only one answer is "creat Inlines and add it to your textBlock".
  but i don't want to do it on my View Model.</p>
  
  <p>So i'm looking for a converter to replace my text attribute by a inlines collection to set on my textBlock.
  I found some example (<a href="https://social.msdn.microsoft.com/Forums/en-US/1a1af975-e186-4167-b1c9-cc86afcdd93a/how-to-show-text-in-textblock-as-rich-text-format?forum=wpf" rel="nofollow">https://social.msdn.microsoft.com/Forums/en-US/1a1af975-e186-4167-b1c9-cc86afcdd93a/how-to-show-text-in-textblock-as-rich-text-format?forum=wpf</a>), but not working on universal Windows apps (UWP).</p>
  
  <p>I tried this but i have an error (unable to cast Binding to string):</p>
  
  <pre><code>&lt;TextBlock  x:Name="newsArticleSections"
                              Tag="{Binding RelativeSource={RelativeSource Self}, Mode=OneWay, Converter={StaticResource TextToRunConverter}, ConverterParameter={Binding ArticleSections}}"/&gt;
  </code></pre>
  
  <p>And this is my converter :</p>
  
  <pre><code>public object Convert(object value, Type targetType, object parameter, string language)
      {
          TextBlock textblock = value as TextBlock;
  
          textblock.ClearValue(TextBlock.TextProperty);
          Run run = new Run();
          run.Text = (string)parameter;
          textblock.Inlines.Add(run);
          return null;
      }
  </code></pre>
  
  <p>It's just the ways that i had explored, but with no result for the moment.
  Does someone has another idea ?</p>