I am trying to align the version of my windows phone application to bottom center of the page. It places it to bottom (below) all the components in view. But not to bottom of my page
<StackPanel>
<TextBlock Text="Username:" Margin="12,0,0,0"/>
<TextBox Text="{Binding UserName, Mode=TwoWay}" c4f:TextBinding.UpdateSourceOnChange="True" InputScope="EmailUserName" />
<TextBlock Text="Password:" Margin="12,0,0,0"/>
<PasswordBox Password="{Binding Password, Mode=TwoWay}" c4f:TextBinding.UpdateSourceOnChange="True" />
<Button Content="Next" IsEnabled="{Binding CanMoveNext}" Command="{Binding LoginCommand}"/>
<TextBlock Text="{Binding ConnectionError}" TextWrapping="Wrap" FontSize="{StaticResource TitleSize}"></TextBlock>
<TextBlock Text="{Binding VersionNumber}" Height="450" Padding="3" TextWrapping="Wrap" VerticalAlignment="Bottom" HorizontalAlignment="Center" FontSize="15"></TextBlock>
</StackPanel>
I want it to be at bottom of the page.
You can use a Grid
for this:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
...
</StackPanel>
<TextBlock Grid.Row="1" Text="{Binding VersionNumber}" Padding="3" TextWrapping="Wrap" HorizontalAlignment="Center" FontSize="15"/>
</Grid>
This Grid
contains two rows. The second row takes as much height as needed by its content, the first row takes the remaining height. A nice article explaining this can be found on visualstudiomagazine.com: Windows Phone Layout Using Grid
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With