Control.VerticalContentAlignment Vlastnost

Definice

Získá nebo nastaví svislé zarovnání obsahu ovládacího prvku.

public:
 property System::Windows::VerticalAlignment VerticalContentAlignment { System::Windows::VerticalAlignment get(); void set(System::Windows::VerticalAlignment value); };
[System.ComponentModel.Bindable(true)]
public System.Windows.VerticalAlignment VerticalContentAlignment { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.VerticalContentAlignment : System.Windows.VerticalAlignment with get, set
Public Property VerticalContentAlignment As VerticalAlignment

Hodnota vlastnosti

VerticalAlignment

Jedna z VerticalAlignment hodnot. Výchozí formát je Top.

Atributy

Příklady

Následující příklad ukazuje, jak nastavit svislou vlastnost zarovnání obsahu ovládacího prvku.

<Button Name="btn8" Height="50"
        VerticalContentAlignment="Top" 
        Click="ChangeVerticalContentAlignment">
  VerticalContentAlignment
</Button>
void ChangeVerticalContentAlignment(object sender, RoutedEventArgs e)
{
    if (btn8.VerticalContentAlignment == VerticalAlignment.Top)
    {
        btn8.VerticalContentAlignment = VerticalAlignment.Bottom;
        btn8.Content = "Control vertical alignment changes from top to bottom.";
    }
    else
    {
        btn8.VerticalContentAlignment = VerticalAlignment.Top;
        btn8.Content = "VerticalContentAlignment";
    }
}
Private Sub ChangeVerticalContentAlignment(ByVal Sender As Object, ByVal e As RoutedEventArgs)

    If (btn8.VerticalContentAlignment = VerticalAlignment.Top) Then

        btn8.VerticalContentAlignment = VerticalAlignment.Bottom
        btn8.Content = "Control vertical alignment changes from top to bottom."

    Else

        btn8.VerticalContentAlignment = VerticalAlignment.Top
        btn8.Content = "VerticalContentAlignment"
    End If
End Sub

Poznámky

Kromě Top, Bottoma Center, můžete nastavit VerticalContentAlignment vlastnost na Stretch, která roztáhne podřízený prvek vyplnit přidělený prostor rozložení nadřazeného prvku. Další informace najdete v tématu Zarovnání, Okraje a Přehled odsazení.

Tato vlastnost má vliv pouze na ovládací prvek, jehož šablona používá VerticalContentAlignment vlastnost jako parametr. U jiných ovládacích prvků tato vlastnost nemá žádný vliv.

Informace o vlastnosti závislosti

Pole identifikátoru VerticalContentAlignmentProperty
Vlastnosti metadat nastavené na true Žádné

Platí pro