HorizontalContentAlignment 속성

Control.HorizontalContentAlignment 속성

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

네임스페이스: System.Windows.Controls
어셈블리: PresentationFramework(presentationframework.dll)
XML 네임스페이스:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

[BindableAttribute(true)] 
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" .../>

속성 값

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";

}
else
{
    btn7.HorizontalContentAlignment=HorizontalAlignment.Left;
    btn7.Content = "Control horizontal alignment changes from left to right.";
}

Microsoft .NET Framework 3.0은 Windows Vista, Microsoft Windows XP SP2 및 Windows Server 2003 SP1에서 지원됩니다.

.NET Framework

3.0에서 지원

커뮤니티 추가 항목

추가
표시:
© 2016 Microsoft