Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account for spacing when determining available space for star rows/columns #3871

Merged
merged 1 commit into from
Jan 26, 2022

Conversation

hartez
Copy link
Contributor

@hartez hartez commented Dec 28, 2021

Fixes #3853
Fixes #3545

@hartez hartez assigned Redth and rachelkang and unassigned Redth Dec 29, 2021
@hartez hartez added this to the 6.0.200-preview.13 milestone Dec 29, 2021
@rachelkang
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@hartez hartez enabled auto-merge (squash) January 4, 2022 22:56
Copy link
Member

@rachelkang rachelkang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT this doesn't fix the issue :(

https://drive.google.com/file/d/1xb5FGcZ7CFrYgcocV5VQpfkUqfyAZ30n/view?usp=sharing

I don't think this has to do with the * as much as it has to do with Auto

@hartez
Copy link
Contributor Author

hartez commented Jan 6, 2022

AFAICT this doesn't fix the issue :(

https://drive.google.com/file/d/1xb5FGcZ7CFrYgcocV5VQpfkUqfyAZ30n/view?usp=sharing

I don't think this has to do with the * as much as it has to do with Auto

Can you post the test project you used for your video?

@rachelkang
Copy link
Member

rachelkang commented Jan 6, 2022

I put this sample code directly in my local version of the control gallery sample:

<views:BasePage
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="Maui.Controls.Sample.Pages.GridPage"
    xmlns:views="clr-namespace:Maui.Controls.Sample.Pages.Base"
    Title="Grid">
    <views:BasePage.Content>
        <GridLayout RowDefinitions="Auto,*, Auto">

            <Label Text="First label" />
            <StackLayout GridLayout.Row="0" x:Name="layoutSample" />
            <Button GridLayout.Row="1" Text="Add control" Clicked="Button_Clicked" Margin="0" Padding="20"/>

        </GridLayout>
    </views:BasePage.Content>
</views:BasePage>
using Microsoft.Maui.Controls;

namespace Maui.Controls.Sample.Pages
{
	public partial class GridPage
	{
		public GridPage()
		{
			InitializeComponent();
		}

	        private void Button_Clicked(object sender, System.EventArgs e)
	        {
		        layoutSample.Children.Add(new Label() { Text = "random label", HeightRequest = 100 });
	        }
	}
}

It uses <GridLayout RowDefinitions="Auto,*, Auto"> like the samples in the referenced issues do

@jsuarezruiz jsuarezruiz added the area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter label Jan 10, 2022
@hartez
Copy link
Contributor Author

hartez commented Jan 24, 2022

@rachelkang I think your test XAML has some errors. Both the Label with the text "First Label" and the StackLayout are in row 0 of the Grid, and the Button is in row 1; the last row is empty.

Also, the issue doesn't appear unless the Grid has RowSpacing or ColumnSpacing greater than zero (depending on whether you're reproducing it vertically or horizontally).

@hartez hartez merged commit 90255e1 into main Jan 26, 2022
@hartez hartez deleted the fix-3853 branch January 26, 2022 12:39
StephaneDelcroix pushed a commit that referenced this pull request Jan 28, 2022
…lumns (#3871)

* Ensure that Grid accounts for spacing when determining available space for star rows/columns
Fixes #3853

* Reorganize
@github-actions github-actions bot locked and limited conversation to collaborators Dec 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter
Projects
None yet
4 participants