I have this XAML:
Is there some way to shift that unicode character
Another alternative which doesn't involve binding is to use TextBlock.Inlines
<my:String x:Key="TooltipSign">ⓘ</my:String>
<TextBlock HorizontalAlignment="Right" Margin="10">
<Run Text="Message with unicode char:"/>
<Run Text="{StaticResource TooltipSign}"
FontWeight="Bold" Foreground="Orange" Background="Black"/>
</TextBlock>
TextBlock.Inlines
is a content property of TextBlock, so <TextBlock.Inlines>
tag can be omitted. Inlines provide additional decorating possibilities, like coloring part of the text:
This will also work:
<Window.Resources>
<system:String x:Key="ToolTipChar">ⓘ</system:String>
</Window.Resources>
...
<TextBlock Text="{Binding StringFormat='Message with unicode char: {0}',
Source={StaticResource ToolTipChar}}" />
I find it slightly more readable, and easier to understand, than putting the replacement token directly in the string
resource.
If I understand your question correctly, this should work:
<Window.Resources>
<s:String x:Key="ToolTipChar">{0}ⓘ</s:String>
</Window.Resources>
...
<TextBlock Text="{Binding Source='Message with unicode char:', StringFormat={StaticResource ToolTipChar}}" />