Bug 24669 - Grid with Labels inside ViewCell - cell height incorrect
Summary: Grid with Labels inside ViewCell - cell height incorrect
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.0
Hardware: Other Other
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-11-19 13:20 UTC by daniel.luberda
Modified: 2015-02-10 08:50 UTC (History)
4 users (show)

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


Attachments
Screenshot (69.66 KB, image/png)
2014-11-19 13:21 UTC, daniel.luberda
Details
Sample App (5.66 MB, application/zip)
2014-11-24 10:09 UTC, Udham Singh
Details


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:
VERIFIED FIXED

Description daniel.luberda 2014-11-19 13:20:39 UTC
Xamarin.Forms 1.3.0 PRE1 Android

Just run this code and see result (also take a look at screenshot). On PRE0 it worked fine. 

public class XamarinViewCellGridEmptySpace : ContentPage
    {
        class SampleViewModel
        {
            public string TextLong { get; set; }

            public string TextShort { get; set; }
        }

        string[] strings = {
            "Lorem ipsum dolor sit amet enim",
            "Etiam ullamcorper",
            "Suspendisse a pellentesque dui, non felis",
            "Maecenas malesuada elit lectus felis, malesuada ultricies",
            "Curabitur et ligula",
            "Ut molestie a, ultricies porta urna",
            "Vestibulum commodo volutpat a, convallis ac, laoreet enim"
        };

        string[] stringsShort = {
            "Lorem",
            "Etiam",
            "Suspendisse",
            "Maecenas",
            "Curabitur",
            "Ut molestie",
            "Vestibulum"
        };

        ObservableCollection<SampleViewModel> items = new ObservableCollection<SampleViewModel>();

        public XamarinViewCellGridEmptySpace()
        {
            Title = "XamarinViewCellGridEmptySpace";

            var customersList = new ListView
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                ItemTemplate = new DataTemplate(typeof(TemplateLayout)),
                ItemsSource = items,
                HasUnevenRows = true,
            };

            Content = customersList;

            for (int i = 0; i < strings.Length; i++)
            {
                items.Add(new SampleViewModel() {
                    TextLong = strings[i],
                    TextShort = stringsShort[i]
                });
            }
        }

        private class TemplateLayout : ViewCell
        {
            public TemplateLayout()
            {
                var customerName = new Label() {
                    Style = Device.Styles.TitleStyle,
                    VerticalOptions = LayoutOptions.Fill,
                    HorizontalOptions = LayoutOptions.Fill,
                    InputTransparent = true,
                };
                customerName.SetBinding<SampleViewModel>(Label.TextProperty, v => v.TextLong, BindingMode.OneWay);

                var customerShortName = new Label() {
                    VerticalOptions = LayoutOptions.Fill,
                    HorizontalOptions = LayoutOptions.Fill,
                    InputTransparent = true,
                };
                customerShortName.SetBinding<SampleViewModel>(Label.TextProperty, v => v.TextShort, BindingMode.OneWay);

                var customerTaxId = new Label() {
                    HorizontalOptions = LayoutOptions.End,
                    VerticalOptions = LayoutOptions.Fill,
                    InputTransparent = true,
                };
                customerTaxId.SetBinding<SampleViewModel>(Label.TextProperty, v => v.TextShort, BindingMode.OneWay);

                var customerAddress = new Label() {
                    HorizontalOptions = LayoutOptions.Fill,
                    VerticalOptions = LayoutOptions.Fill,
                    InputTransparent = true,
                };
                customerAddress.SetBinding<SampleViewModel>(Label.TextProperty, v => v.TextLong, BindingMode.OneWay);

                var root = new Grid() {
                    HorizontalOptions = LayoutOptions.Fill,
                    VerticalOptions = LayoutOptions.Fill,
                    InputTransparent = true,
                    RowDefinitions = 
                    {
                        new RowDefinition { Height = GridLength.Auto },
                        new RowDefinition { Height = GridLength.Auto },
                        new RowDefinition { Height = GridLength.Auto },
                    },
                    ColumnDefinitions = 
                    {
                        new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
                        new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
                    }
                    };

                root.Children.Add(customerName, 0, 2, 0, 1);
                root.Children.Add(customerShortName, 0, 1, 1, 2);
                root.Children.Add(customerTaxId, 1, 2, 1, 2);
                root.Children.Add(customerAddress, 0, 2, 2, 3);

                View = root;
            }
        }
    }
Comment 1 daniel.luberda 2014-11-19 13:21:07 UTC
Created attachment 8805 [details]
Screenshot
Comment 2 Udham Singh 2014-11-24 10:09:07 UTC
Created attachment 8847 [details]
Sample App

I have checked this issue and observed that cells are not taking correct height (Grid with Labels inside ViewCell). To check this issue I have created a Xamarin.Forms app and implemented the code provided in bug description, set android app as a startup project and run the app.

I am attaching the app which I have created to test this issue.

Screencast : http://www.screencast.com/t/HwYeJhvxkP

Environment Info :

Xamarin.Forms : 1.3.0.6275-pre1

=== Xamarin Studio ===

Version 5.5.4 (build 15)
Installation UUID: ce927b2a-2c07-44c5-b186-09cfdafba6dc
Runtime:
	Mono 3.10.0 ((detached/92c4884)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000031

=== Xamarin.Android ===

Version: 4.20.0.28 (Enterprise Edition)
Android SDK: /Users/xamarin76/Desktop/android-sdk-macosx
	Supported Android versions:
		1.6    (API level 4)
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.0    (API level 11)
		3.1    (API level 12)
		3.2    (API level 13)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Apple Developer Tools ===

Xcode 6.1 (6602)
Build 6A1052c

=== Xamarin.Mac ===

Version: 1.11.1.89 (Enterprise Edition)

=== Xamarin.iOS ===

Version: 8.4.0.43 (Enterprise Edition)
Hash: 840a925
Branch: 
Build date: 2014-11-16 21:03:22-0500

=== Build Information ===

Release ID: 505040015
Git revision: f93940a35458a18052f1a25e106e62ca970d9c40
Build date: 2014-11-19 15:32:41-05
Xamarin addins: dc23cbd91a3a0e1d326328e1229e86c942a49ec8

=== Operating System ===

Mac OS X 10.9.4
Darwin Xamarin76s-Mac-mini.local 13.3.0 Darwin Kernel Version 13.3.0
    Tue Jun  3 21:27:35 PDT 2014
    root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
Comment 3 Jason Smith [MSFT] 2014-12-11 11:00:09 UTC
Resolved in next pre-release
Comment 4 Udham Singh 2015-02-10 08:50:31 UTC
I have checked this issue with Xamarin.Forms Version 1.3.4.6325-pre1 and observed that now this is working fine. Hence I am closing this issue.

Please refer the screencast : http://www.screencast.com/t/UGea8Er0b

Environment Info :

Xamarin.Forms : 1.3.4.6325-pre1

Mac OS X 10.9.5
Xamarin Studio 5.7.1 (build 17)
Mono 3.12.0 ((detached/a813491)
GTK+ 2.24.23 (Raleigh theme)
Xcode 6.2 (6770)
Xamarin.iOS 8.6.1.24 (Business Edition)
Xamarin.Android 4.20.0.28 (Business Edition)