title: WPF MVVM customizing ListView cell to insert hyperlink and change text color
body: <p>I have a GridView cell in a ListView that is defined as a TextBlock and bound to a string on my ViewModel. I want to be able to change parts of the text into hyperlinks and part into different colors programatically.</p>
  
  <p>Here is the XAML for the GridView cell:</p>
  
  <pre><code>&lt;GridViewColumn.CellTemplate&gt;
      &lt;DataTemplate&gt;
          &lt;Border BorderThickness="2" BorderBrush="#dfdfdf" HorizontalAlignment="Stretch"&gt;
              &lt;TextBlock Text="{Binding Data}" Margin="3"/&gt;    
          &lt;/Border&gt;
      &lt;/DataTemplate&gt;
  &lt;/GridViewColumn.CellTemplate&gt;
  </code></pre>
  
  <p>And here's what it looks like at the moment:</p>
  
  <p><img src="https://i.stack.imgur.com/UeXDh.jpg" alt="WPF Listview cell"></p>
  
  <p>An example of the text that is bound would be:</p>
  
  <pre><code>&lt;color:#ff0000&gt;Test item&lt;/color&gt;
  Test item 2
  &lt;link:http://www.google.com&gt;Test hyperlink&lt;/link&gt;
  </code></pre>
  
  <p>I have no problem with the regex to parse the bound text and pull out the required information but how would I go about changing the TextBlock into different colors and add a hyperlink?</p>
  
  <p>Thanks in advance</p>