Bug 26672 - Cannot bind text cell to a list view
Summary: Cannot bind text cell to a list view
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.2
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Seth Rosetter
URL:
Depends on:
Blocks:
 
Reported: 2015-02-02 23:58 UTC by Cody Beyer (MSFT)
Modified: 2015-05-19 20:21 UTC (History)
4 users (show)

Tags: android textcell listview bindings
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 ANSWERED

Description Cody Beyer (MSFT) 2015-02-02 23:58:52 UTC
### Description

The test case attempts to being a textcell to a list view and display as such

### Test Case

https://drive.google.com/file/d/0B63k5Cx2MUgqUG9wR1JrVFJhUUE/view?usp=sharing

### Steps to Reproduce

1. Download and open test case
2. Deploy to Xamarin Android Player

### Expected Results 

Text cell is bound to a ListView with the strings "String" and "String2"

### Actual results

Text simply displays as "label"

### Version

=== Xamarin Studio ===

Version 5.7 (build 661)
Installation UUID: 05ebd865-76e1-4bc2-84a5-7bba54e97af1
Runtime:
	Mono 3.12.0 ((detached/a813491)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000068

=== Apple Developer Tools ===

Xcode 6.1.1 (6611)
Build 6A2008a

=== Xamarin.iOS ===

Version: 8.6.0.51 (Business Edition)
Hash: dfb682f
Branch: 
Build date: 2015-01-08 13:39:32-0500

=== Xamarin.Android ===

Version: 4.20.0.28 (Business Edition)
Android SDK: /Users/codybeyer/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0.3 (API level 15)
		4.4   (API level 19)
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.Mac ===

Version: 1.10.0.18 (Business Edition)

=== Build Information ===

Release ID: 507000661
Git revision: b70bab61da996da29045ea8ee8aed1a6faedbe78
Build date: 2015-01-05 16:31:31-05
Xamarin addins: 82f6c71490562d6cd125a09287f441902fdac3d7

=== Operating System ===

Mac OS X 10.10.2
Darwin beyer.local 14.1.0 Darwin Kernel Version 14.1.0
    Mon Dec 22 23:10:38 PST 2014
    root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64
Comment 1 Rajneesh Kumar 2015-02-03 05:35:32 UTC
I have checked this issue and able to reproduce this. To reproduce this issue I have followed the steps provided in bug description. 

I observed that, after deploying the application I am able to see  text as label only as described in bug description. Please refer the screencast : http://www.screencast.com/t/sLgxzLnNVV

Ide Logs: https://gist.github.com/Rajneesh360Logica/8d6d00e1f728e219cfd0
Android tools Log: https://gist.github.com/Rajneesh360Logica/9b5c32994519b5628d58
Application Output: https://gist.github.com/Rajneesh360Logica/8c9dc12b9227e76665a3
Build Output: https://gist.github.com/Rajneesh360Logica/fa53972bc364ba95be9c
XAP Device Logs: https://gist.github.com/Rajneesh360Logica/c746714130d5a054c83a

Environment Info:

Xamarin.Forms : 1.3.3.6318-pre1

=== Xamarin Studio ===

Version 5.7.1 (build 16)
Installation UUID: 011d70a5-dede-428b-ab04-ef451c2e539d
Runtime:
	Mono 3.12.0 ((detached/a813491)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000068

=== Xamarin.Android ===

Version: 4.20.0.28 (Business Edition)
Android SDK: /Users/MM/Desktop/android-sdk-macosx
	Supported Android versions:
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.1    (API level 12)
		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 (6604)
Build 6A1052d

=== Xamarin.iOS ===

Version: 8.6.1.20 (Business Edition)
Hash: 3b3ef43
Branch: 
Build date: 2015-01-24 09:42:21-0500

=== Xamarin.Mac ===

Version: 1.12.0.4 (Business Edition)

=== Build Information ===

Release ID: 507010016
Git revision: f12fcaf4707ab436bee2df6263eb5333197b262c
Build date: 2015-02-01 21:06:05-05
Xamarin addins: f7b7d34419c9ec24501bfa7c658e80a6305613e0

=== Operating System ===

Mac OS X 10.9.5
Darwin MacMini.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 2 Seth Rosetter 2015-05-19 20:21:37 UTC
Hi,

Please verify that you are binding to properties as well as correctly setting the BindingContext. I have provided a simple sample of a ListView count with a TextCell. Let me know if this helps you resolve the issue

public class MainPageListDemo : ContentPage
{
	public class SampleListItem
	{
		public string Txt { get; set; }
		public string Dtl { get; set; }

		public SampleListItem (string txt, string dtl)
		{
			Txt = txt;
			Dtl = dtl;
		}
	}

	public MainPageListDemo ()
	{
		var items = new List<SampleListItem> { 
			new SampleListItem("String1-1", "String1-2"),
			new SampleListItem("String2-1", "String2-2")
		};

		var cellTemplate = new DataTemplate (typeof(TextCell));
		cellTemplate.SetBinding (TextCell.TextProperty, "Txt");
		cellTemplate.SetBinding (TextCell.DetailProperty, "Dtl");

		var list = new ListView {
			BindingContext = items,
			ItemTemplate = cellTemplate,
			ItemsSource = items
		};

		Content = list;
	}	
}