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!
- <Grid x:Name="container">
- <Grid.Background>
- <LinearGradientBrush>
- <GradientStop Offset="0" Color="#FF5D6C80"/>
- <GradientStop Offset="1" Color="#FF283446"/>
- </LinearGradientBrush>
- </Grid.Background>
-
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"></RowDefinition>
- <RowDefinition Height="Auto"></RowDefinition>
- <RowDefinition Height="Auto"></RowDefinition>
- <RowDefinition Height="Auto"></RowDefinition>
- </Grid.RowDefinitions>
-
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
-
- <TextBlock Name="LocationTextBlock" Margin="0,10,0,0" FontSize="24" Foreground="White" HorizontalAlignment="Right" Grid.Row="0" FontFamily="{StaticResource Montserrat-Light}"/>
- <TextBlock Name="DescriptionTextBlock" Margin="0,15,0,0" FontSize="16" Foreground="White" HorizontalAlignment="Center" Grid.Column="1" Grid.Row="0" FontFamily="{StaticResource Montserrat-UltraLight}"/>
-
- <Image Name="ResultImage" Margin="0,5,0,0" Width="50" Height="50" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="1"/>
- <TextBlock Name="TempTextBlock" FontSize="52" Foreground="White" HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="1" Grid.Row="1" FontFamily="{StaticResource Montserrat-Light}" />
- <Image Name="Metrix" Width="20" Height="20" Margin="5,10,0,0" HorizontalAlignment="Center" Grid.Column="2" Grid.Row="1"/>
-
- <TextBlock Margin="0,0,15,0" Name="textHumidity" FontSize="12" Foreground="White" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="2" FontFamily="{StaticResource Montserrat-Light}" />
- <TextBlock Margin="0,0,15,0" Name="resultHumidity" FontSize="14" Foreground="White" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="3" FontFamily="{StaticResource Montserrat-Light}"/>
-
- <TextBlock Name="textSunrise" FontSize="12" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1" Grid.Row="2" FontFamily="{StaticResource Montserrat-Light}" />
- <TextBlock Name="resultSunrise" FontSize="14" Foreground="White" HorizontalAlignment="Center" Grid.Column="1" VerticalAlignment="Center" Grid.Row="3" FontFamily="{StaticResource Montserrat-Light}"/>
-
- <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}" />
- <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}"/>
- </Grid>