我正在测试具有一些texboxes的WPF应用程序。当屏幕大小不足以显示完整的文本框文本时,将其用省略号“截断”:ABCDEDF
=> ABC ...
我想测试这种行为,但无法从任何文本属性中获取值ABC ...
,始终无法获得ABCDEF
,有什么建议吗?
最佳答案
从Microsoft参考:
/// <summary>
/// The TextTrimming property specifies the trimming behavior situation
/// in case of clipping some textual content caused by overflowing the line's box.
/// </summary>
public TextTrimming TextTrimming
{
get { return (TextTrimming)GetValue(TextTrimmingProperty); }
set { SetValue(TextTrimmingProperty, value); }
}
TextTrimming定义如何在WPF TextBlock中修剪文本。