Bug 31237 - Custom ViewCell Renderer Does Not Render A StackLayout
Summary: Custom ViewCell Renderer Does Not Render A StackLayout
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 1.4.3
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-06-18 19:12 UTC by Jimmy [MSFT]
Modified: 2015-07-14 21:41 UTC (History)
4 users (show)

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

Repro project (181.61 KB, application/zip)
2015-06-18 19:12 UTC, Jimmy [MSFT]
Repro project (175.57 KB, application/zip)
2015-06-26 13:20 UTC, Jimmy [MSFT]

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:

Description Jimmy [MSFT] 2015-06-18 19:12:46 UTC
Created attachment 11672 [details]
Repro project

*** Overview ***
Using a custom renderer to display a custom view cell does not work if the view uses a StackLayout.
Tested with 1.4.2 and 1.4.3-pre3

*** Steps to Reproduce ***
1. Run the attached repro project

*** Actual Results ***
The cells are rendered empty.

*** Expected Results ***
The cell is rendered with the layout and controls declared in the xaml page. 

Using a single Label instead of a layout works. To test, in TestPage.xaml comment out the StackLayout and uncomment line 21. 

*** Environment Info ***
=== Xamarin Studio ===

Version 5.9.3 (build 1)
Installation UUID: 94ce5106-6a72-4691-b34e-cd5857b1db66
	Mono 4.0.1 ((detached/ed1d3ec)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400010044

=== Apple Developer Tools ===

Xcode 6.3.2 (7718)
Build 6D2105

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: e6ebd18
Branch: master
Build date: 2015-05-21 21:55:09-0400

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/jimmygarrido/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.4   (API level 19)
		5.0   (API level 21)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: (Business Edition)

=== Build Information ===

Release ID: 509030001
Git revision: 5a524e1726ed103fdd4fe37e0356f2b35466ce9d
Build date: 2015-06-02 16:35:08-04
Xamarin addins: 51957cfbd06be911b212671ad05c2c6221ac90f9

=== Operating System ===

Mac OS X 10.10.3
Darwin Jimmys-MacBook-Pro.local 14.3.0 Darwin Kernel Version 14.3.0
    Mon Mar 23 11:59:05 PDT 2015
    root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
Comment 4 Jimmy [MSFT] 2015-06-26 13:20:10 UTC
Created attachment 11756 [details]
Repro project

Updating the repro project to one that demonstrates the issue is actually when using a ListView custom renderer.

When using a StackLayout for the custom ListView item template, the layout is not rendered because the elements inside of it are given a height of 0.

*** Workarounds ***
- Set the "HeightRequest" property for the elements inside the layout
- Use a grid with row definitions
Comment 5 Jason Smith [MSFT] 2015-07-14 21:41:20 UTC
This is caused by not calling

view.SetValue (Platform.RendererProperty, renderer);

however Platform.RendererProperty is internal. This will need to be opened in the future once the API is finalized. There is already an open issue for this somewhere.