Control.HorizontalContentAlignment Property

Definition

Gets or sets the horizontal alignment of the control's content.

Equivalent WinUI property: Microsoft.UI.Xaml.Controls.Control.HorizontalContentAlignment.

public:
 property HorizontalAlignment HorizontalContentAlignment { HorizontalAlignment get(); void set(HorizontalAlignment value); };
HorizontalAlignment HorizontalContentAlignment();

void HorizontalContentAlignment(HorizontalAlignment value);
public HorizontalAlignment HorizontalContentAlignment { get; set; }
var horizontalAlignment = control.horizontalContentAlignment;
control.horizontalContentAlignment = horizontalAlignment;
Public Property HorizontalContentAlignment As HorizontalAlignment
<control HorizontalContentAlignment="horizontalAlignmentMemberName"/>

Property Value

HorizontalAlignment

One of the HorizontalAlignment values. The default is Left.

Remarks

Each control might apply this property differently based on the Style setters for the control's implicit style, and its visual template. Also, the apparent "default value" of each individual control used in UI can be different. For example, a Button control starts with the value Center.

A value for the HorizontalContentAlignment property only affects layout behavior for a control when its template uses the HorizontalContentAlignment property as the source of a HorizontalAlignment value for presenters or content areas within. On other controls, setting HorizontalContentAlignment has no effect. For more info about visual templates for controls, see the reference for Control.Template.

Applies to

See also