TextBloc可以将TextTrimming属性设置为CharacterEllipsis
其他控件可以在控件大小变更或者其他事件上附加下列方法
private void OnEllipsis(object sender, SizeChangedEventArgs e)
{
FormattedText formattedText = new FormattedText(
this.Header.ToString(),
Thread.CurrentThread.CurrentCulture,
this.FlowDirection,
new Typeface(this.FontFamily, this.FontStyle, this.FontWeight, this.FontStretch),
this.FontSize,
this.Foreground); this.IsEllipsis = formattedText.Width > e.NewSize.Width;
}