Bug 27689 - GroupHeaderCells disappear when item is removed from a group in ListView (iOS only)
Summary: GroupHeaderCells disappear when item is removed from a group in ListView (iOS...
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.4.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-03-05 08:54 UTC by Borislav Parvanov
Modified: 2015-04-27 11:29 UTC (History)
5 users (show)

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


Attachments
Test Sample (4.63 MB, application/zip)
2015-03-18 08:34 UTC, Abhishek
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 Borislav Parvanov 2015-03-05 08:54:48 UTC
When you click the [Remove] button the group headers of the ListView will disappear.

using System;
using Xamarin.Forms;
using System.Collections.ObjectModel;

namespace XFPlayground
{
	class GroupedItems : ObservableCollection<string> {
		public GroupedItems (string groupName) { GroupName = groupName; }
		public string GroupName { get; private set; }
	}

	class HeaderCell : ViewCell
	{
		public HeaderCell () {
			Height = 44;
			var label = new Label { BackgroundColor = Color.Pink };
			label.SetBinding (Label.TextProperty, "GroupName");
			View = label;
		}
	}

	class ItemCell : ViewCell
	{
		public ItemCell () {
			var label = new Label { BackgroundColor = Color.Aqua };
			label.SetBinding (Label.TextProperty, ".");
			View = label;
		}
	}

	public class App : Application
	{
		public App ()
		{
	
			var items = new ObservableCollection<GroupedItems> () {
				new GroupedItems ("1") { "1.1", "1.2", "1.3" },
				new GroupedItems ("2") { "2.1", "2.2", "2.3" },
				new GroupedItems ("3") { "3.1", "3.2", "3.3" },
				new GroupedItems ("4") { "4.1", "4.2", "4.3" },
			};

			var listview = new ListView {
				HasUnevenRows = true,
				IsGroupingEnabled = true
			};

			listview.GroupHeaderTemplate = new DataTemplate (typeof(HeaderCell));
			listview.ItemTemplate = new DataTemplate (typeof(ItemCell));
			listview.ItemsSource = items;

			var btnRemove = new Button () { Text = "Remove" };
			btnRemove.Clicked += delegate {
				if (items[1].Count > 0) {
					items[1].RemoveAt(0);
				}
			};

			MainPage = new ContentPage {
				Content = new StackLayout {
					Orientation = StackOrientation.Vertical,
					Children = { listview, btnRemove }
				}
			};
		}
	}
}
Comment 1 Abhishek 2015-03-18 08:34:03 UTC
Created attachment 10394 [details]
Test Sample

I have tried this issue and able to reproduce the reported behavior at my end.

Steps To Reproduce.
1.Create an Xamarin.Forms (PCL) Sample.
2. Add the above code in the App class.
3. Run the application on Simulator/Device.
4. click on Remove button it will remove the header as well as list cell.

Screencast: http://www.screencast.com/t/NUyif92CK
IOS Device Log: https://gist.github.com/Abhishekk360/cd84afb6bd5d3faf974b
IDE Log: https://gist.github.com/Abhishekk360/01f4e82c4f1d71d74ca2

Build Info:

Xamarin.Forms: 1.4.1.6342-pre1, 1.4.0.6341

=== Xamarin Studio ===

Version 5.9 (build 245)
Installation UUID: 93e693b0-b53d-40f4-b29c-b61ff5cbe892
Runtime:
	Mono 4.0.0 ((detached/1605a60)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400000083

=== Apple Developer Tools ===

Xcode 6.2 (6776)
Build 6C131e

=== Xamarin.iOS ===

Version: 8.10.0.129 (Enterprise Edition)
Hash: 1e50a6d
Branch: master
Build date: 2015-03-17 23:33:47-0400

=== Xamarin.Android ===

Version: 5.1.0.64 (Enterprise Edition)
Android SDK: /Users/xamarin23/Desktop/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		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_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: 2.0.0.90 (Enterprise Edition)

=== Build Information ===

Release ID: 509000245
Git revision: e249c35434b118ed16bae67d35f756b3119bef4b
Build date: 2015-03-17 15:49:56-04
Xamarin addins: a2b515f29d591552e7c5f978c03d9c75efc820aa

=== Operating System ===

Mac OS X 10.10.0
Darwin 800BC.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Comment 2 Parmendra Kumar 2015-04-27 11:29:07 UTC
I have checked this issue with Xamarin.forms 1.4.3.6358-pre2 and its working fine at my end.

Hence closing this issue.