У меня есть две сетки одинакового размера, но я хочу, чтобы одна из них была больше, а когда я изменяю размер строки, другая сетка становится меньше. Возможно, я не понимаю, кто работает с сетками, но последняя строка с высотой = "*" должна масштабироваться в соответствии с моими строками.
Я пробовал это:
<Grid.RowDefinitions>
<RowDefinition Height="0.05*"/>
<RowDefinition Height="0.9*"/>
<RowDefinition Height="0.05*"/>
<RowDefinition Height="1.2*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.05*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="0.05*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="0.05*"/>
</Grid.ColumnDefinitions>
И выглядит так, если вы сравните с другим изображением, вы увидите, что первые две кнопки изменили размеры, и мне нужны только секунды.
Нормальный код.
<Grid Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="0.05*"/>
<RowDefinition Height="0.9*"/>
<RowDefinition Height="0.05*"/>
<RowDefinition Height="0.9*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.05*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="0.05*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="0.05*"/>
</Grid.ColumnDefinitions>
<Frame BackgroundColor="#40000000" BorderColor="#FFFFFF" CornerRadius="6" Padding="0" Grid.Row="1" Grid.Column="1">
<Grid RowSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="0.2*"/>
<RowDefinition Height="0.02*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.001*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="0.001*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Row="0" Grid.Column="1" RowSpacing="0" x:Name="MiddleGrid">
<Grid.RowDefinitions>
<RowDefinition Height="0.7*"/>
<RowDefinition Height="2.5*"/>
<RowDefinition Height="0.3*"/>
<RowDefinition Height="0.6*"/>
<RowDefinition Height="0.7*" x:Name="Price"/>
</Grid.RowDefinitions>
<Image Source="melaopresunto.png" Grid.Row="1" x:Name="CategoryImage"/>
<Label Text="Melão c/ Presunto" FontAttributes="Bold" VerticalTextAlignment="Start" TextColor="White" HorizontalTextAlignment="Center" Grid.Row="3"/>
<Label Text="6.90€" VerticalTextAlignment="Center" TextColor="White" HorizontalTextAlignment="Center" Grid.Row="4"/>
</Grid>
<Grid Grid.Row="1" Grid.Column="1" IsVisible="False" x:Name="Quantity" RowSpacing="0" ColumnSpacing="0" BackgroundColor="#800E152F">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="0.5*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.05*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="0.05*"/>
</Grid.RowDefinitions>
<Button Text="-" TextColor="White" Padding="0" CornerRadius="4" FontAttributes="Bold" FontSize="Small" IsEnabled="False" BackgroundColor="#3F3C42" Clicked="QntLabelLess" x:Name="QntLess" Grid.Column="0" Grid.Row="1"/>
<Label Text="1" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" TextColor="White" Grid.Column="1" x:Name="QntLabel" Grid.Row="1"/>
<Button Text="+" Padding="0" CornerRadius="4" FontAttributes="Bold" FontSize="Small" TextColor="#000000" BackgroundColor="#FF8A00" Clicked="QntLabelPlus" Grid.Column="2" Grid.Row="1" x:Name="QntPlus"/>
</Grid>
<Grid RowSpacing="0" Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="0.03*"/>
<RowDefinition Height="0.25*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.25*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ImageButton Source="sobremesa.png" BackgroundColor="Black" Clicked="Ingredients" x:Name="Ingredient" Grid.Row="1" Grid.Column="0">
</ImageButton>
</Grid>
</Grid>
<Frame.GestureRecognizers>
<TapGestureRecognizer
Tapped="TapGestureRecognizer_Tapped"
NumberOfTapsRequired="1"/>
</Frame.GestureRecognizers>
</Frame>
<Frame BackgroundColor="#40000000" BorderColor="#FFFFFF" CornerRadius="6" Padding="0" Grid.Row="1" Grid.Column="3">
<Grid RowSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="0.2*"/>
<RowDefinition Height="0.02*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.001*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="0.001*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Row="0" Grid.Column="1" RowSpacing="0" x:Name="MiddleGrid1">
<Grid.RowDefinitions>
<RowDefinition Height="0.7*"/>
<RowDefinition Height="2.5*"/>
<RowDefinition Height="0.3*"/>
<RowDefinition Height="0.6*"/>
<RowDefinition Height="0.7*" x:Name="Price1"/>
</Grid.RowDefinitions>
<Image Source="melaopresunto.png" Grid.Row="1" x:Name="CategoryImage1"/>
<Label Text="Melão c/ Presunto" FontAttributes="Bold" VerticalTextAlignment="Start" TextColor="White" HorizontalTextAlignment="Center" Grid.Row="3"/>
<Label Text="6.90€" VerticalTextAlignment="Center" TextColor="White" HorizontalTextAlignment="Center" Grid.Row="4"/>
</Grid>
<Grid Grid.Row="1" Grid.Column="1" IsVisible="False" x:Name="Quantity1" RowSpacing="0" ColumnSpacing="0" BackgroundColor="#800E152F">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="0.5*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.05*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="0.05*"/>
</Grid.RowDefinitions>
<Button Text="-" TextColor="White" Padding="0" CornerRadius="4" FontAttributes="Bold" FontSize="Small" IsEnabled="False" BackgroundColor="#3F3C42" Clicked="QntLabelLess1" x:Name="QntLess1" Grid.Column="0" Grid.Row="1"/>
<Label Text="1" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" TextColor="White" Grid.Column="1" x:Name="QntLabel1" Grid.Row="1"/>
<Button Text="+" Padding="0" CornerRadius="4" FontAttributes="Bold" FontSize="Small" TextColor="#000000" BackgroundColor="#FF8A00" Clicked="QntLabelPlus1" Grid.Column="2" Grid.Row="1" x:Name="QntPlus1"/>
</Grid>
</Grid>
<Frame.GestureRecognizers>
<TapGestureRecognizer
Tapped="TapGestureRecognizer_Tapped1"
NumberOfTapsRequired="1"/>
</Frame.GestureRecognizers>
</Frame>
<Frame BackgroundColor="#40000000" BorderColor="#FFFFFF" CornerRadius="6" Padding="0" Grid.Row="3" Grid.Column="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.2*"/>
<RowDefinition Height="2.8*"/>
<RowDefinition Height="0.7*"/>
<RowDefinition Height="0.7*"/>
<RowDefinition Height="0.2*"/>
</Grid.RowDefinitions>
<Image Source="carne.png" Grid.Row="1"/>
<Label Text="Pomedoro" VerticalTextAlignment="Start" TextColor="White" HorizontalTextAlignment="Center" Grid.Row="2"/>
<Label Text="3,50€" VerticalTextAlignment="Start" TextColor="White" HorizontalTextAlignment="Center" Grid.Row="3"/>
</Grid>
</Frame>
<Frame BackgroundColor="#40000000" BorderColor="#FFFFFF" CornerRadius="6" Padding="0" Grid.Row="3" Grid.Column="3">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.2*"/>
<RowDefinition Height="2.8*"/>
<RowDefinition Height="0.7*"/>
<RowDefinition Height="0.7*"/>
<RowDefinition Height="0.2*"/>
</Grid.RowDefinitions>
<Image Source="carne.png" Grid.Row="1"/>
<Label Text="Salada de Legumes" VerticalTextAlignment="Start" TextColor="White" HorizontalTextAlignment="Center" Grid.Row="2"/>
<Label Text="5,50€" VerticalTextAlignment="Start" TextColor="White" HorizontalTextAlignment="Center" Grid.Row="3"/>
</Grid>
</Frame>
</Grid>
Я знаю, что кода много, но вам не нужно знать, что находится внутри фрейма.