Bug 21398 - Grid no longer respects gridlength Star value
Summary: Grid no longer respects gridlength Star value
Status: RESOLVED DUPLICATE of bug 21379
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.2
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-07-17 14:05 UTC by Eric Grover
Modified: 2014-07-17 14:11 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED DUPLICATE of bug 21379

Description Eric Grover 2014-07-17 14:05:43 UTC
Since I installed Xamarin.Forms 1.2.1.0, it broke my grid layout.  The following code previously would right justify the firstTeamScore and secondTeamScore labels in the container grid.  It no longer does so.  It seems that it no longer respects the GridUnitType.Star value.  This change has effected both iOS and Android apps.

     var scorePanel = new StackLayout
            {
                Padding = 5,
                HorizontalOptions = LayoutOptions.Fill
            };

            var teamGrid1 = new Grid
            {
                Padding = new Thickness(6, 6, 6, 6),
                BackgroundColor = AppColors.AccentColor,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                RowDefinitions = 
                {
                    new RowDefinition { Height = GridLength.Auto },
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star )},
                    new ColumnDefinition { Width = GridLength.Auto }
                }
            };

            var teamGrid2 = new Grid
            {
                Padding = new Thickness(6, 0, 6, 6),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                RowDefinitions = 
                {
                    new RowDefinition { Height = GridLength.Auto },
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star )},
                    new ColumnDefinition { Width = GridLength.Auto }
                }
            };

            var firstTeamName = new Label { TextColor = Color.White, Font = Font.SystemFontOfSize(FontSize.Medium) };
            firstTeamName.SetBinding(Label.TextProperty, EnterStatsFootballViewModel.FirstTeamNamePropertyName);

            var secondTeamName = new Label { TextColor = Color.White, Font = Font.SystemFontOfSize(FontSize.Medium) };
            secondTeamName.SetBinding(Label.TextProperty, EnterStatsFootballViewModel.SecondTeamNamePropertyName);

            var firstTeamScore = new Label { TextColor = Color.White, Font = Font.SystemFontOfSize(FontSize.Medium) };
            firstTeamScore.SetBinding(Label.TextProperty, new Binding(EnterStatsFootballViewModel.FirstTeamScorePropertyName, BindingMode.Default, new IntToStringConverter()));

            var secondTeamScore = new Label { TextColor = Color.White, Font = Font.SystemFontOfSize(FontSize.Medium) };
            secondTeamScore.SetBinding(Label.TextProperty, new Binding(EnterStatsFootballViewModel.SecondTeamScorePropertyName, BindingMode.Default, new IntToStringConverter()));

            teamGrid1.Children.Add(firstTeamName, 0, 0);
            teamGrid2.Children.Add(secondTeamName, 0, 1);
            teamGrid1.Children.Add(firstTeamScore, 1, 0);
            teamGrid2.Children.Add(secondTeamScore, 1, 1);
            scorePanel.Children.Add(teamGrid1);
            scorePanel.Children.Add(teamGrid2);

            var scoreContainer = new Grid
            {
                BackgroundColor = AppColors.DarkContainer,
                Children = { scorePanel }
            };

            teamGrid1.GestureRecognizers.Add(new TapGestureRecognizer 
            { 
                Command = new Command(() =>
                {
                    viewModel.SelectedTeam = EnterStatsFootballViewModel.Teams.Team1;
                    teamGrid1.BackgroundColor = AppColors.AccentColor;
                    teamGrid2.BackgroundColor = Color.Transparent;
                })
            });

            teamGrid2.GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() =>
                {
                    viewModel.SelectedTeam = EnterStatsFootballViewModel.Teams.Team2;
                    teamGrid1.BackgroundColor = Color.Transparent;
                    teamGrid2.BackgroundColor = AppColors.AccentColor;
                })
            });
            #endregion

            var teamsGrid = new Grid
            {
                BackgroundColor = AppColors.DarkContainer,
                RowDefinitions = { new RowDefinition {  Height = GridLength.Auto } }
            };

            Content = new StackLayout
            {
                Padding = 20,
                Children = 
                {
                    scoreContainer
                }
            };
Comment 1 Eric Grover 2014-07-17 14:09:07 UTC

*** This bug has been marked as a duplicate of bug 21379 ***