Я создаю ресурсный словарь с набором system: string, который я могу вызвать с помощью DynamicResource. Я пытаюсь выделить определенный текст в строке другим цветом, поэтому мне не нужно делать так много «Выполнить текст»
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:System;assembly=mscorlib">
<Image.ToolTip>
<ToolTip BorderBrush="LightGoldenrodYellow" BorderThickness="1" Background="Black">
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Foreground="LightGoldenrodYellow" FontSize="14" FontWeight="Bold">
<Run Text="{DynamicResource Example}"/>
<Run Text="{DynamicResource Example1}" FontStyle="Italic" FontSize="12" FontWeight="Normal"/>
</TextBlock>
</ToolTip>
</Image.ToolTip>
<s:String x:Key="Example" xml:space="preserve">Lucky Dice</s:String>
<s:String x:Key="Example1" xml:space="preserve"> Has a 30% chance to get an extra item.</s:String>
</ResourceDictionary>
<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><s:String x:Key="Example" xml:space="preserve"> Has a <Font color=red>30%</font> chance to get an extra item.</s:String>