Bug 41205 - Override ListView.CreateDefault, parameter is always string
Summary: Override ListView.CreateDefault, parameter is always string
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 2.2.0
Hardware: PC Windows
: Normal blocker
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-05-20 09:34 UTC by Pascal Empl
Modified: 2016-09-15 14:42 UTC (History)
6 users (show)

Tags: ac
Is this bug a regression?: Yes
Last known good build: 2.0.1.6505


Attachments
Example Project (108.89 KB, application/x-zip-compressed)
2016-05-20 09:34 UTC, Pascal Empl
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 Pascal Empl 2016-05-20 09:34:43 UTC
Created attachment 16047 [details]
Example Project

On Android and iOS it works correct. Only on UWP

Works in 2.0.0.6490
Works in 2.0.1.6505
Doesn't work in 2.2.0.31
Doesn't work in 2.3.0.34-pre1
Doesn't work in 2.3.0.38-pre2

Result:
Parameter for CreateDefault should be the currentItem not currentItem.ToString()
Comment 1 h.ulutas 2016-05-27 14:31:09 UTC
The importance level should be revised. Because this bug completely prevent override CreateDefault method and customize the behavior of list. And it was not exist on previous versions, produced by new version.
Comment 2 Paul DiPietro [MSFT] 2016-05-27 15:01:54 UTC
This will be looked at as it is a regression.
Comment 3 Samantha Houts [MSFT] 2016-07-19 01:36:41 UTC
Should be fixed in 2.3.2-pre1. Thanks!
Comment 4 Parmendra Kumar 2016-08-04 18:58:51 UTC
I have checked this issue with Xamarin.Forms 2.3.2.118-pre1 and I am still facing same issue.
This issue is working fine with X.F 2.0.1.6505.

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

Hence reopened this issue.
Comment 5 Pascal Empl 2016-08-05 07:13:55 UTC
My reported bug is fixed but the BindingContext(DataContext) for the Label(TextBox) isn't applied correct. It is the ViewCell not my ViewModel.

This is a different behavior then on iOS and Android.
Comment 6 Samantha Houts [MSFT] 2016-08-08 17:48:23 UTC
@Pascal It looks like your sample will work as expected if you uncomment the line you've added to set the BindingContext to the item.


            templateCell.BindingContext = item;
Comment 7 Pascal Empl 2016-08-09 06:49:24 UTC
@Samantha, i know if i use "templateCell.BindingContext = item" that it works but there are still two reasons why this is a bug.

In the documentation for ListView.CreateDefault it is said that the BindingContext will be set automatically.

See in the Remarks: https://developer.xamarin.com/api/member/Xamarin.Forms.ListView.CreateDefault/p/System.Object/

This doesn't happen for UWP and that is the second reason as it is a different behavior then on iOS and Android.

Setting the BindingContext in CreateDefault can only be temporary fix.
Comment 8 Samantha Houts [MSFT] 2016-08-09 17:28:48 UTC
@Pascal You're right! I think I see where the problem is. Thank you!
Comment 9 Rui Marinho 2016-08-11 09:40:37 UTC
Should be fixed in 2.3.2-pre2
Comment 10 Parmendra Kumar 2016-09-15 14:42:57 UTC
I have checked this issue with Xamarin.Forms 2.3.2.127 and its working fine.

Hence closing this issue.