Search code examples
xamarinuitableviewxamarin.formscustom-renderer

Custom ViewCell after xamarin forms 2.0 upgrade renders the Entries with a 1 pixel height


I've provided a link to a fairly simple, drilled down version of our app. What you will see in it is that I've a simple Forms app consisting of 2 pages. My first page just has a button to navigate to a second page. My Second page has a TableView with Custom ViewCells using EntryRenderer on Windows Phone.

This was all working fine up until XF 1.5 & then we decided to upgrade to XF 2.0 Now it does not work. All my entries in that custom view cell are shrunk to a height of 1 pixel.

Here is the glitch though. I figured that if the page using the table view with custom viewCell & entry renderers is the first page of your app then all works fine.. but if it's somewhere in in the navigation stack.. then you will see all entries are shrunk.

Attached is a sample project. If you run it as it is you will see a page that looks beautiful. If you comment the MainPage = new NavigationPage(new SecondPage()); & uncomment the MainPage = new NavigationPage(new FirstPage());

On App.cs & run the app again on the WP device you will see the issue I am referring to.

A fix is really appreciated for it.

Here is the sample code:

https://github.com/supreettare/TableViewInWP

Thanks


Solution

  • There were numerous changes made between Forms 1.5 and 2.0 which were necessary, and as a result some new bugs may show themselves over time. In this case, the shortest answer is that there's a bug involving the way that navigation and the timing of layout rendering works; it appears to affect normal Entry cells as well, so long as they are inside a grid as your sample project shows. As such, this issue has been acknowledged and should be resolved in a future version of Forms.

    A potential workaround right now involves either setting a HeightRequest for the Entry in question or adding Grid.RowDefinition values (with heights) for the Grid itself. This may cause some awkward padding as a side effect, but the entries should appear as expected.