WPF でこれを行う組み込みの機能があるとは思いませんが、間違っている可能性があります。
以下のコードは、これを行う独自のコントロールを作成する方法を示しています。それは効率的ではなく、フォントなどを制御するためのより多くのプロパティを含む微調整で行うことができますが、アイデアは得られます:
SpacedTextBlock.cs :
public class SpacedTextBlock : Control
{
public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text",
typeof(string),
typeof(SpacedTextBlock));
public string Text
{
get { return GetValue(TextProperty) as string; }
set { SetValue(TextProperty, value); }
}
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
if (Text != null)
{
var widthPerChar = ActualWidth / Text.Length;
var currentPosition = 0d;
foreach (var ch in Text)
{
drawingContext.DrawText(new FormattedText(ch.ToString(), CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, new Typeface("Arial"), 12, Foreground), new Point(currentPosition, 0));
currentPosition += widthPerChar;
}
}
}
}
Window1.xaml :
<local:SpacedTextBlock Text="Hello"/>
結果:
代替テキスト http://img199.imageshack.us/img199/8022/screenshotud.png