Bug 46278 - [UWP] Group headers in a ListView do not go below a certain height
Summary: [UWP] Group headers in a ListView do not go below a certain height
Status: CONFIRMED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.2
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-11-02 00:27 UTC by Stacy Henwood
Modified: 2017-10-10 13:14 UTC (History)
4 users (show)

Tags: listview group header height ac, uwp
Is this bug a regression?: ---
Last known good build:


Attachments
Reproducer project (367.46 KB, application/x-zip-compressed)
2016-11-02 00:35 UTC, Stacy Henwood
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 for Bug 46278 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description Stacy Henwood 2016-11-02 00:27:00 UTC
We are seeing the following crash when binding FontSize in a listview. This SEEMSto be limited to the group header, but this is not confirmed.

   at Xamarin.Forms.Platform.WinPhone.FontExtensions.ApplyFont(TextBlock self, Font font)
   at Xamarin.Forms.Platform.WinPhone.LabelRenderer.UpdateFont(TextBlock textBlock)
   at Xamarin.Forms.Platform.WinPhone.LabelRenderer.OnElementPropertyChanged(Object sender, PropertyChangedEventArgs e)
   at System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e)
   at Xamarin.Forms.BindableObject.OnPropertyChanged(String propertyName)
   at Xamarin.Forms.Element.OnPropertyChanged(String propertyName)
   at Xamarin.Forms.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent)
   at Xamarin.Forms.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)
   at Xamarin.Forms.BindableObject.SetValue(BindableProperty property, Object value, Boolean fromStyle, Boolean checkAccess)
   at Xamarin.Forms.Label.OnFontSizeChanged(BindableObject bindable, Object oldValue, Object newValue)
   at Xamarin.Forms.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent)
   at Xamarin.Forms.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)
   at Xamarin.Forms.BindingExpression.ApplyCore(Object sourceObject, BindableObject target, BindableProperty property, Boolean fromTarget)
   at Xamarin.Forms.BindingExpression.Apply(Object sourceObject, BindableObject target, BindableProperty property)
   at Xamarin.Forms.Binding.Apply(Object newContext, BindableObject bindObj, BindableProperty targetProperty)
   at Xamarin.Forms.BindableObject.ApplyBindings(Object oldContext, Boolean skipBindingContext)
   at Xamarin.Forms.BindableObject.SetInheritedBindingContext(BindableObject bindable, Object value)
   at Xamarin.Forms.Element.SetChildInheritedBindingContext(Element child, Object context)
   at Xamarin.Forms.Element.OnBindingContextChanged()
   at Xamarin.Forms.View.OnBindingContextChanged()
   at Xamarin.Forms.BindableObject.SetInheritedBindingContext(BindableObject bindable, Object value)
   at Xamarin.Forms.Element.SetChildInheritedBindingContext(Element child, Object context)
   at Xamarin.Forms.Element.OnBindingContextChanged()
   at Xamarin.Forms.Cell.OnBindingContextChanged()
   at Xamarin.Forms.BindableObject.BindingContextPropertyBindingPropertyChanged(BindableObject bindable, Object oldvalue, Object newvalue)
   at Xamarin.Forms.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent)
   at Xamarin.Forms.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)
   at Xamarin.Forms.BindableObject.SetValue(BindableProperty property, Object value, Boolean fromStyle, Boolean checkAccess)
   at Xamarin.Forms.TemplatedItemsList`2.<UnhookItem>d__153.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__3(Object state)

It would APPEAR that the FontExtensions.ApplyFont thinks (incorrectly) that a NamedSize is being used but that the font.NamedSize is not valid.

Attached is a small app that creates the problem. The UWP version doesnt crash, but the WP8 one does.

We are encountering this because we are making a UWP version of the app, and the font sizes are wildy different between platforms, meaning that we need to set the FontSize where we have set them manually in the XAML in the past.
Comment 1 Stacy Henwood 2016-11-02 00:35:55 UTC
Created attachment 18293 [details]
Reproducer project

I removed the packages folder to make it fit with your attachment size limit
Comment 2 Stacy Henwood 2016-11-02 00:57:54 UTC
In addition, I just noticed that the reproducer also shows another bug in UWP. 

The group header template is ALWAYS at least (about) 40 pixels high. it doesnt seem to be possible to make it smaller, meaning that there is horrible empty space between the group layout and the first item.
Comment 3 Stacy Henwood 2016-12-21 02:02:40 UTC
Is anyone going to acknowledge this bug? I reported this 2 months ago, provided a project which exhibits the problem, and its still listed as "NEW".

This is causing us so much wasted time as we have to produce a datatemplate for EVERY font size which creates a maintenance nightmare.
Comment 4 Paul DiPietro [MSFT] 2017-03-20 21:27:08 UTC
WP8 is no longer supported.

The second issue with UWP appears legitimate and looks similar to https://bugzilla.xamarin.com/show_bug.cgi?id=45015 (at a glance at that issue's description). I would likely adjust the subject of this issue to reflect that aspect and set it to confirmed until it can be further investigated.
Comment 5 Marcin Gierlasiński 2017-10-09 13:22:29 UTC
I have also issues with setting group header size smaller (for me the requirement is 25 units in xaml). Maybe there is a way to change it in "native" resources in UWP project by overriding Forms styles located here https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.UAP/Resources.xaml ?
Comment 6 Marcin Gierlasiński 2017-10-10 13:14:21 UTC
I found the solution. To change/remove minimum height of a GroupHeaderTemplate you have to override ListViewGroup style in UWP's Application resources:

<GroupStyle x:Key="ListViewGroup" HidesIfEmpty="False">
	<GroupStyle.HeaderContainerStyle>
		<Style TargetType="ListViewHeaderItem">
			<Setter Property="Margin" Value="0"/>
			<Setter Property="MinHeight" Value="0"/>
			<Setter Property="Template">
			   <Setter.Value>
				<ControlTemplate>
					<uwp:ListGroupHeaderPresenter />
				</ControlTemplate>
			   </Setter.Value>
			</Setter>
		</Style>
	</GroupStyle.HeaderContainerStyle>
	<GroupStyle.HeaderTemplate>
		<DataTemplate>
			<uwp:CellControl IsGroupHeader="true" 
			HorizontalContentAlignment="Stretch" />
		</DataTemplate>
	</GroupStyle.HeaderTemplate>
</GroupStyle>

You can find more info about styling UWP group header here:
https://stackoverflow.com/questions/33673019/how-do-i-remove-listview-groupstyle-header-seperator-line