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