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

[Net7] ScrollView/Grid/Label width calculation broken on .Net 7, no issue on .Net 6 #11873

Open
MartinRothschink opened this issue Dec 5, 2022 · 3 comments
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter layout-grid platform/android 🤖 platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@MartinRothschink
Copy link

Description

Width of Grid inside a ScrollView is changed if label text changes. This did not happen with .Net 6.

.Net 7 behaviour after start
2022-12-05_17h34_17

Click on Start button to change the text, the grid column widths change. Click on Stop to undo the change.
2022-12-05_17h34_21

.Net 6 behaviour is fine
2022-12-05_17h37_18

Steps to Reproduce

  1. Create a new MAUI app
  2. Replace MainPage.xaml with
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MauiApp1.MainPage">

    <ScrollView>
        <Grid ColumnDefinitions="2*, 1*, 3*" RowDefinitions="Auto,*" ColumnSpacing="4" RowSpacing="4">

            <Border Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" >
                <Grid ColumnDefinitions="72,72,*" ColumnSpacing="4" RowSpacing="4">
                    <Button Grid.Column="0" Text="Start" Pressed="ButtonStart_Pressed" />
                    <Button Grid.Column="1" Text="Stop"  Pressed="ButtonStop_Pressed"/>
                    <Label Grid.Column="2" x:Name="Label" Text="Short text" LineBreakMode="WordWrap" VerticalOptions="Center"/>
                </Grid>
            </Border>

            <Border Grid.Row="1" Grid.Column="0" Padding="24">
                <Rectangle BackgroundColor="Aqua"></Rectangle>
            </Border>

            <Border Grid.Row="1" Grid.Column="1" Padding="24">
                <Rectangle BackgroundColor="Aqua"></Rectangle>
            </Border>

            <Border Grid.Row="1" Grid.Column="2" Padding="24">
                <Rectangle BackgroundColor="Aqua"></Rectangle>
            </Border>
        </Grid>
    </ScrollView>
</ContentPage>
  1. Replace MainPage.xaml.cs with
namespace MauiApp1;

public partial class MainPage : ContentPage
{
	public MainPage()
	{
		InitializeComponent();
	}

	private void ButtonStart_Pressed(object sender, EventArgs e)
	{
        	Label.Text = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.";
	}

	private void ButtonStop_Pressed(object sender, EventArgs e)
	{
		Label.Text = "Short text";
	}
}
  1. Run with .Net 7 and click Start/Stop

Link to public reproduction project repository

https://github.com/MartinRothschink/WidthBug

Version with bug

7.0 (current)

Last version that worked well

6.0.424

Affected platforms

Android, Windows, I was not able test on other platforms

Affected platform versions

Android 7 and later, Windows 10/11

Did you find any workaround?

No response

Relevant log output

No response

@MartinRothschink MartinRothschink added the t/bug Something isn't working label Dec 5, 2022
@Eilon Eilon added the area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter label Dec 5, 2022
@PureWeen
Copy link
Member

PureWeen commented Dec 6, 2022

possibly related #11878

@PureWeen PureWeen added this to the Backlog milestone Dec 6, 2022
@ghost
Copy link

ghost commented Dec 6, 2022

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@Zhanglirong-Winnie Zhanglirong-Winnie added s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage labels Jun 6, 2023
@Zhanglirong-Winnie
Copy link

Verified this issue with Visual Studio Enterprise 17.7.0 Preview 1.0. Can repro on windows platform with sample project.
WidthBug-master.zip
Screenshot 2023-06-06 173530

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter layout-grid platform/android 🤖 platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants