Bug 29109 - ViewCells overlay each other when used in TableView on iOS. Exception on Windows Phone
Summary: ViewCells overlay each other when used in TableView on iOS. Exception on Wind...
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 1.3.1
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-04-15 03:48 UTC by John Hardman
Modified: 2015-05-22 20:00 UTC (History)
3 users (show)

Tags: iOS ViewCell HasUnevenRows TableView Exception WindowsPhone WinPhone
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 NOT_ON_ROADMAP

Description John Hardman 2015-04-15 03:48:08 UTC
When the following code is run on Android and Windows Phone, it does what is expected (shows two ViewCells followed by two TextCells). However, on iOS, the two View Cells and the first Text Cell overlap each other, making the display unreadable.


using Xamarin.Forms;

namespace ViewCellInTableIssue
{
    public class App : Application
    {
        public App()
        {

            // The root page of your application
            MainPage = new ContentPage
            {
                BackgroundColor = Color.Default,
                Content = new TableView
                {
                    BackgroundColor = Color.Default,
                    ClassId = "ClassId_TableViewMenuIntent",
                    HasUnevenRows = true, 
                    InputTransparent = false,
                    Intent = TableIntent.Menu,
                    IsEnabled = true,
                    IsVisible = true,
                    StyleId = "StyleId_ContentsTableView",
                    Root = new TableRoot("TableRoot Title")
                    {
                        new TableSection("TableSection Heading")
                        {
                            new ViewCell
                            {
                                View = new ContentView
                                {
                                    HorizontalOptions = LayoutOptions.Fill,
                                    VerticalOptions = LayoutOptions.StartAndExpand,
                                    Content = new StackLayout
                                    {
                                        //HeightRequest = 50,
                                        HorizontalOptions = LayoutOptions.Fill,
                                        Orientation = StackOrientation.Vertical,
                                        VerticalOptions = LayoutOptions.StartAndExpand,
                                        Children =
                                        {
                                            new Label
                                            {
                                                FontAttributes = FontAttributes.Bold,
                                                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof (Label)),
                                                HorizontalOptions = LayoutOptions.Fill,
                                                Text = "Title",
                                                TextColor = Color.Lime,
                                            },
                                            new Label
                                            {
                                                FontAttributes = FontAttributes.Italic,
                                                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof (Label)),
                                                HorizontalOptions = LayoutOptions.Fill,
                                                LineBreakMode = LineBreakMode.WordWrap,
                                                Text =
                                                    "a long piece of text that I really, really want to word-wrap across three lines, possibly more, but no less than two",
                                                TextColor = Color.Yellow,
                                                VerticalOptions = LayoutOptions.StartAndExpand,
                                            }
                                        }
                                    }
                                }
                            },
                            new ViewCell
                            {
                                View = new ContentView
                                {
                                    HorizontalOptions = LayoutOptions.Fill,
                                    VerticalOptions = LayoutOptions.StartAndExpand,
                                    Content = new StackLayout
                                    {
                                        //HeightRequest = 50,
                                        HorizontalOptions = LayoutOptions.Fill,
                                        Orientation = StackOrientation.Vertical,
                                        VerticalOptions = LayoutOptions.StartAndExpand,
                                        Children =
                                        {
                                            new Label
                                            {
                                                BackgroundColor = Color.Aqua,
                                                FontAttributes = FontAttributes.Bold,
                                                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof (Label)),
                                                HorizontalOptions = LayoutOptions.Fill,
                                                Text = "Title",
                                                TextColor = Color.Blue,
                                            },
                                            new Label
                                            {
                                                BackgroundColor = Color.Fuchsia,
                                                FontAttributes = FontAttributes.Italic,
                                                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof (Label)),
                                                HorizontalOptions = LayoutOptions.Fill,
                                                LineBreakMode = LineBreakMode.WordWrap,
                                                Text =
                                                    "a long piece of text that I really, really want to word-wrap across three lines, possibly more, but no less than two",
                                                TextColor = Color.Yellow,
                                                VerticalOptions = LayoutOptions.StartAndExpand,
                                            }
                                        }
                                    }
                                }
                            },
                            new TextCell
                            {
                                Text = "TextCell text",
                                TextColor = Device.OnPlatform(Color.Default, Color.Lime, Color.Default),
                                Detail = "TextCell Detail - a short one",
                                DetailColor = Color.Accent,
                                StyleId = "StyleId_Option3",
                            },
                            new TextCell
                            {
                                Text = "TextCell another text",
                                TextColor = Device.OnPlatform(Color.Default, Color.Lime, Color.Default),
                                Detail =
                                    "TextCell Detail - a much longer piece of text, that would be really great if it got word wrapped across as many lines as it takes, but doesn't seem to now",
                                DetailColor = Color.Accent,
                                StyleId = "StyleId_Option4",
                            }
                        }
                    }
                }
            };
        }

        protected override void OnStart()
        {
            // Handle when your app starts
        }

        protected override void OnSleep()
        {
            // Handle when your app sleeps
        }

        protected override void OnResume()
        {
            // Handle when your app resumes
        }
    }
}
Comment 1 John Hardman 2015-04-15 04:38:14 UTC
Note that upgrading to XF 1.4.0 results in a further problem. On Windows Phone, that upgraded build results in:

System.IO.FileNotFoundException occurred
Message: A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.ni.dll
Additional information: Could not load file or assembly 'System.Windows.debug.resources, Version=2.0.6.0, Culture=en-US, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified.
Comment 2 glucose1e 2015-04-21 06:12:07 UTC
Same problem happened in 1.4.2-pre2 IOS
Comment 3 Jason Smith [MSFT] 2015-05-22 20:00:55 UTC
iOS TableView does not support automatic resizing of cells. This is only supported by ListView. You must set the Cell.Height property when using uneven rows in a tableview.