FrameworkElement.VerticalAlignment property

Expand
This topic has not yet been rated - Rate this topic

FrameworkElement.VerticalAlignment property

[This documentation is preliminary and is subject to change.]

Gets or sets the vertical alignment characteristics that are applied to a FrameworkElement when it is composed in a parent object such as a panel or items control.

Syntax


public VerticalAlignment VerticalAlignment { get; set; }


<frameworkElement VerticalAlignment="verticalAlignmentMemberName"/>

XAML Values

verticalAlignmentMemberName

A constant name from the VerticalAlignment enumeration, for example Top.

Property value

Type: VerticalAlignment

A vertical alignment setting as a value of the enumeration. The default is Stretch.

Examples

In This example, the value Center is assigned to HorizontalAlignment and VerticalAlignment to position the TextBlock elements in the center of the Grid cells.


<Grid x:Name="LayoutRoot" Background="Coral" Width="300" Height="100">
    <Grid.ColumnDefinitions>
        <ColumnDefinition />
        <ColumnDefinition />
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition />
        <RowDefinition />
    </Grid.RowDefinitions>
    <TextBlock Grid.Column="0" Grid.Row="0" Text="First Name" 
        HorizontalAlignment="Center" VerticalAlignment="Center" />
    <TextBlock Grid.Column="0" Grid.Row="1" Text="Last Name" 
        HorizontalAlignment="Center" VerticalAlignment="Center" />
    <TextBox Grid.Column="1" Grid.Row="0" />
    <TextBox Grid.Column="1" Grid.Row="1" />

</Grid>


Requirements

Minimum supported client

Windows 8 Release Preview

Minimum supported server

Windows Server 2012

Namespace

Windows.UI.Xaml
Windows::UI::Xaml [C++]

Metadata

Windows.winmd

See also

FrameworkElement

 

 

Build date: 5/22/2012

Did you find this helpful?
(1500 characters remaining)
Community Additions ADD