1
Answer

Positioning the elements right

Hello everyone. I am making a simple weather app and I have some problems with the XAML code. My C# code is finished already and working well, but I don't seem to position the elements where I want them to be. I tried with grid and stackpanel, but every time I try to move one element, all the others just move too and, yeah...
 
Here is what I am trying to do.
 
 
Can somebody help me, please? 
 
Here is my XAML code. The texts are added later on with C#. Thank you all very much!
 
  1. <Grid x:Name="container">  
  2.         <Grid.Background>  
  3.             <LinearGradientBrush>  
  4.                 <GradientStop Offset="0" Color="#FF5D6C80"/>  
  5.                 <GradientStop Offset="1" Color="#FF283446"/>  
  6.             </LinearGradientBrush>  
  7.         </Grid.Background>  
  8.   
  9.         <Grid.RowDefinitions>  
  10.             <RowDefinition Height="Auto"></RowDefinition>  
  11.             <RowDefinition Height="Auto"></RowDefinition>  
  12.             <RowDefinition Height="Auto"></RowDefinition>  
  13.             <RowDefinition Height="Auto"></RowDefinition>  
  14.         </Grid.RowDefinitions>  
  15.   
  16.         <Grid.ColumnDefinitions>  
  17.             <ColumnDefinition Width="Auto" />  
  18.             <ColumnDefinition Width="Auto" />  
  19.             <ColumnDefinition Width="Auto" />  
  20.         </Grid.ColumnDefinitions>  
  21.   
  22.         <TextBlock Name="LocationTextBlock" Margin="0,10,0,0" FontSize="24" Foreground="White" HorizontalAlignment="Right"  Grid.Row="0" FontFamily="{StaticResource Montserrat-Light}"/>  
  23.         <TextBlock Name="DescriptionTextBlock" Margin="0,15,0,0" FontSize="16" Foreground="White" HorizontalAlignment="Center" Grid.Column="1" Grid.Row="0" FontFamily="{StaticResource Montserrat-UltraLight}"/>  
  24.           
  25.         <Image Name="ResultImage" Margin="0,5,0,0" Width="50" Height="50" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="1"/>  
  26.         <TextBlock Name="TempTextBlock" FontSize="52" Foreground="White" HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="1" Grid.Row="1" FontFamily="{StaticResource Montserrat-Light}" />  
  27.         <Image Name="Metrix" Width="20" Height="20" Margin="5,10,0,0" HorizontalAlignment="Center" Grid.Column="2" Grid.Row="1"/>  
  28.   
  29.         <TextBlock Margin="0,0,15,0" Name="textHumidity" FontSize="12" Foreground="White" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="2" FontFamily="{StaticResource Montserrat-Light}" />  
  30.         <TextBlock Margin="0,0,15,0" Name="resultHumidity" FontSize="14" Foreground="White" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="3" FontFamily="{StaticResource Montserrat-Light}"/>  
  31.   
  32.         <TextBlock Name="textSunrise" FontSize="12" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1" Grid.Row="2" FontFamily="{StaticResource Montserrat-Light}" />  
  33.         <TextBlock Name="resultSunrise" FontSize="14" Foreground="White" HorizontalAlignment="Center" Grid.Column="1" VerticalAlignment="Center" Grid.Row="3" FontFamily="{StaticResource Montserrat-Light}"/>  
  34.   
  35.         <TextBlock Margin="15,0,0,0" Name="textSunset" FontSize="12" Foreground="White" HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="3" Grid.Row="2" FontFamily="{StaticResource Montserrat-Light}" />  
  36.         <TextBlock Margin="15,0,0,0" Name="resultSunset" FontSize="14" Foreground="White" HorizontalAlignment="Left"  Grid.Column="3" VerticalAlignment="Center" Grid.Row="3" FontFamily="{StaticResource Montserrat-Light}"/>  
  37.     </Grid> 
Answers (1)