Share via


TextBlock.HorizontalTextAlignment 属性

定义

获取或设置一个值,该值指示文本在 TextBlock 中的对齐方式。

public:
 property TextAlignment HorizontalTextAlignment { TextAlignment get(); void set(TextAlignment value); };
TextAlignment HorizontalTextAlignment();

void HorizontalTextAlignment(TextAlignment value);
public TextAlignment HorizontalTextAlignment { get; set; }
var textAlignment = textBlock.horizontalTextAlignment;
textBlock.horizontalTextAlignment = textAlignment;
Public Property HorizontalTextAlignment As TextAlignment
<TextBlock HorizontalTextAlignment="textAlignmentValue"/>

属性值

指定文本对齐方式的 TextAlignment 枚举值之一。 默认值为 Left

Windows 要求

设备系列
Windows 10 Fall Creators Update (在 10.0.16299.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v5.0 中引入)

注解

此属性提供与 TextAlignment 属性相同的功能。 如果两个属性都设置为冲突值,则使用最后一个属性集。

面向 Fall Creators Update (SDK 16299) 或更高版本的应用应使用此属性,而不是 TextAlignment。 如果应用还支持以前的版本,请参阅 版本自适应应用:在保持与以前版本的兼容性的同时使用新 API ,了解详细信息。

适用于