我正在测试一个有一些 texboxes 的 WPF 应用程序。当屏幕尺寸不足以显示完整的文本框文本时,它会用省略号“截断”:ABCDEDF
=>ABC ...
我想测试这种行为,但永远无法ABC ...
从任何文本属性中获取值,总是得到ABCDEF
,有什么建议吗?
来自微软参考:
/// <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 中修剪文本。