Questa documentazione è stata archiviata e non viene gestita.

Proprietà Control.HorizontalContentAlignment

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

Spazio dei nomi: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
Spazio dei nomi XML:

public HorizontalAlignment HorizontalContentAlignment { get; set; }
/** @property */
public HorizontalAlignment get_HorizontalContentAlignment ()

/** @property */
public void set_HorizontalContentAlignment (HorizontalAlignment value)

public function get HorizontalContentAlignment () : HorizontalAlignment

public function set HorizontalContentAlignment (value : HorizontalAlignment)

<object HorizontalContentAlignment="HorizontalAlignment" .../>

Valore proprietà

The horizontal alignment of a control's content. The default is Left.


 In addition to Left, Right, and Center, you can set the HorizontalContentAlignment property to Stretch, which stretches the child element to fill the allocated space of the parent element. For more information, see Alignment, Margins, and Padding Overview.

Also, the template of a control that inherits the HorizontalContentAlignment property can affect the content layout.

The following example shows how to set the horizontal content alignment property of a control.

<Button Name="btn7" HorizontalContentAlignment="Left" Click="ChangeHorizontalContentAlignment">HorizontalContentAlignment</Button>

if (btn7.HorizontalContentAlignment == HorizontalAlignment.Left)
    btn7.HorizontalContentAlignment = HorizontalAlignment.Right;
    btn7.Content = "HorizontalContentAlignment";

    btn7.Content = "Control horizontal alignment changes from left to right.";

Microsoft .NET Framework 3.0 è supportato in Windows Vista, Microsoft Windows XP SP2 e Windows Server 2003 SP1.

.NET Framework

Supportato in: