Bug 24079 - ListView.GroupHeaderTemplate Background Color Inconsistant
Summary: ListView.GroupHeaderTemplate Background Color Inconsistant
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-10-27 11:37 UTC by Matt Butler
Modified: 2015-01-27 19:07 UTC (History)
4 users (show)

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


Attachments
Xamarin.Forms.ListView.GroupHeaderTemplate.BackgroundColor (131.83 KB, image/png)
2014-10-27 11:37 UTC, Matt Butler
Details
Intial Load (157.06 KB, image/png)
2014-10-29 15:43 UTC, Matt Butler
Details
1 scroll (158.51 KB, image/png)
2014-10-29 15:43 UTC, Matt Butler
Details
2 scroll (157.50 KB, image/png)
2014-10-29 15:43 UTC, Matt Butler
Details
3 scroll (154.82 KB, image/png)
2014-10-29 15:44 UTC, Matt Butler
Details
8 scroll (135.03 KB, image/png)
2014-10-29 15:44 UTC, Matt Butler
Details
11 scroll (137.17 KB, image/png)
2014-10-29 15:44 UTC, Matt Butler
Details
14 scroll (113.97 KB, image/png)
2014-10-29 15:44 UTC, Matt Butler
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:
RESOLVED NOT_REPRODUCIBLE

Description Matt Butler 2014-10-27 11:37:14 UTC
Created attachment 8518 [details]
Xamarin.Forms.ListView.GroupHeaderTemplate.BackgroundColor

When using Xamarin.Forms.ListView.GroupHeaderTemplase.BackgroundColor the setting of colors is not consistent on Android.  It works right on iOS.  I am doing this from Xaml.  Below is my complete xaml file.  This is bound in the .cs file to a ViewModel with an ObservableCollection<T>  

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
					   xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
					   x:Class="Journyx.PCL.X3.View.ProjectList"
             Title="Search Projects">
  <ContentPage.Content>
    <StackLayout>
      <StackLayout Padding="5">
        <Entry x:Name="SearchEntry" Placeholder="Search Projects (Type Here)"
            Text="{Binding SearchText}"/>
      </StackLayout>
      <ListView x:Name="listView"
                ItemsSource="{Binding ProjectsGrouped}"
                IsGroupingEnabled="true"
                ItemSelected="OnItemSelected"
                GroupDisplayBinding="{Binding Key}"
                GroupShortNameBinding="{Binding Key}"
                HasUnevenRows="True">
        <ListView.GroupHeaderTemplate>
          <DataTemplate>
            <ViewCell Height="25">
              <StackLayout Padding="5,0,0,0"
                           VerticalOptions="FillAndExpand"
                           BackgroundColor="Color.Blue">
                <Label Text="{Binding Key}" TextColor="White" VerticalOptions="Center"/>
              </StackLayout>
            </ViewCell>
          </DataTemplate>
        </ListView.GroupHeaderTemplate>
        <ListView.ItemTemplate>
          <DataTemplate>
            <ViewCell>
              <StackLayout HorizontalOptions="FillAndExpand" Orientation="Horizontal">
                <StackLayout Padding="5,0,0,0" VerticalOptions="StartAndExpand" Orientation="Vertical" BackgroundColor="Color.Default">
                  <Label Text="{Binding Desc}" YAlign="Center" Font="Medium" LineBreakMode="WordWrap" />
                </StackLayout>
              </StackLayout>
            </ViewCell>
          </DataTemplate>
        </ListView.ItemTemplate>
      </ListView>
    </StackLayout>
  </ContentPage.Content>
</ContentPage>

Attached is a image of the issue on a GenyMotion emulator.
Comment 1 Arpit Jha 2014-10-29 03:19:34 UTC
We have checked this issue and observed that ListView.GroupHeaderTemplate Background Color working fine.

We tried following steps to reproduce it.
1.Create a Xamarin form Application.
2.Add a Xaml class.
3.Did following code in it.

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
			xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
			x:Class="WorkingWithListview.BasicListXaml"
			Padding="0,20,0,0">

  <ListView
      x:Name="ModuleList"
      ItemsSource="{Binding .}"
      IsGroupingEnabled="True"
      HasUnevenRows="True">
    <ListView.GroupHeaderTemplate>
      <DataTemplate>
        <ViewCell>
          <ViewCell.View >
            <StackLayout Padding="5,0,0,0"
                          VerticalOptions="FillAndExpand"
                          BackgroundColor="Color.Blue">
              <Label Text="Mytext" TextColor="White" VerticalOptions="Center"/>
            </StackLayout>
          </ViewCell.View>
        </ViewCell>
      </DataTemplate>
    </ListView.GroupHeaderTemplate>
    <ListView.ItemTemplate>
      <DataTemplate>
        <ViewCell>
          <ViewCell.View>
            <StackLayout Orientation="Horizontal" Padding="10" BackgroundColor="White">
              <Label Text="{Binding Title}" />
            </StackLayout>
          </ViewCell.View>
        </ViewCell>
      </DataTemplate>
    </ListView.ItemTemplate>
  </ListView>

</ContentPage>


using System;
using System.Collections.Generic;
using Xamarin.Forms;
using System.Diagnostics;

namespace WorkingWithListview
{	
	public partial class BasicListXaml : ContentPage
	{	
		public BasicListXaml ()
		{
			InitializeComponent ();

			this.BindingContext = new [] { "a", "b", "c" };

            this.Title = "Helloooooo";
		}

		void OnItemTapped (object sender, ItemTappedEventArgs e) {
			if (e == null) return; // has been set to null, do not 'process' tapped event
			Debug.WriteLine("Tapped: " + e.Item);
			((ListView)sender).SelectedItem = null; // de-select the row
		}



	}
}


4.Run the application.

We observed that ListView.GroupHeaderTemplate Background Color property working fine.

Is this Same behavior you are facing ?

Screencast regarding Same:
http://screencast.com/t/ifePWviZ

Environment Info:
Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641

Installed Version: Professional

Xamarin   3.7.230.0 (e78d10d6993f95fc3ebe791aeb4aacff165bf8bb)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   4.18.0.39 (0ef616ae42005ece52f6df7aa1e093ceb11998f8)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   8.4.0.0 (209abebbd8f1a292d042420edb45fa5fbd3f017b)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 2 Matt Butler 2014-10-29 15:42:32 UTC
I believe this issue is related to scrolling a LARGE observablecollection bound to a listview.  Your test case will not create the issue because it only has 3 items that do not scroll off screen.  The list I am using has 265 items that are grouped into 30ish grouped items based on sorting them by the first letter of the description.  

When I run the test, on the first run, the initial screen is correct, but if I start scrolling up and down, by the time I've scrolled off the top and back to it again 14 times, EVERY cell is then blue.  I have attached images that show the impact by scroll.
Comment 3 Matt Butler 2014-10-29 15:43:14 UTC
Created attachment 8546 [details]
Intial Load
Comment 4 Matt Butler 2014-10-29 15:43:29 UTC
Created attachment 8547 [details]
1 scroll
Comment 5 Matt Butler 2014-10-29 15:43:46 UTC
Created attachment 8548 [details]
2 scroll
Comment 6 Matt Butler 2014-10-29 15:44:02 UTC
Created attachment 8549 [details]
3 scroll
Comment 7 Matt Butler 2014-10-29 15:44:17 UTC
Created attachment 8550 [details]
8 scroll
Comment 8 Matt Butler 2014-10-29 15:44:33 UTC
Created attachment 8551 [details]
11 scroll
Comment 9 Matt Butler 2014-10-29 15:44:48 UTC
Created attachment 8552 [details]
14 scroll
Comment 10 Arpit Jha 2014-10-30 02:13:43 UTC
@Matt ,
We have checked this issue and unable to reproduce this it with the help of comment 2 .We took a scrolling listview but unable to reproduce.

Screencast regarding Same:
http://screencast.com/t/pHlZ5zfkl

Could you please provide us Sample project,So that we can able to reproduce at our end?
Comment 11 Matt Butler 2014-10-31 15:09:55 UTC
Howdy,

This bug can be resolved for the time being.  I am implementing binding on colors within my Listviews for a template type functionality and it has solved the color issue.
Comment 12 Jason Smith [MSFT] 2015-01-27 19:07:53 UTC
Thank you