Bug 34917 - Dynamically setting a listview's footer doesn't work
Summary: Dynamically setting a listview's footer doesn't work
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.5.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-10-15 16:14 UTC by Erik Renaud
Modified: 2017-12-07 17:52 UTC (History)
7 users (show)

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

repro project (326.32 KB, application/zip)
2017-01-20 00:27 UTC, Jimmy [MSFT]

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 34917 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:

Description Erik Renaud 2015-10-15 16:14:28 UTC
I have a listview and would like to show, when the listview has 1 item in it something in the footer.
To do this, in the class behind the xaml file, I listen for a property change on the view model.

If it is true, I have code that does something like this :
            AbsoluteLayout absoluteLayout = new AbsoluteLayout();
            absoluteLayout.MinimumHeightRequest = 200;
            absoluteLayout.MinimumWidthRequest = 200;
            absoluteLayout.BackgroundColor = Color.Pink;

            var image = new Image()
                Source = ResourceEx.Render("ic_arrow_topRight_[theme].png"),
                Aspect = Aspect.AspectFit
            AbsoluteLayout.SetLayoutBounds(image, new Rectangle(0.5, 0, 40, 40));
            AbsoluteLayout.SetLayoutFlags(image, AbsoluteLayoutFlags.PositionProportional);

            var label = new Label()
                Text = "Tap on an item\nto get a menu",
                XAlign = TextAlignment.End,
                YAlign = TextAlignment.Start,
                LineBreakMode = LineBreakMode.WordWrap,
                FontSize = FontSizeEx.Render("Micro", typeof(Label))
            AbsoluteLayout.SetLayoutBounds(label, new Rectangle(0, 0, (TabAbsoluteLayout.Width * 50) - 25, -1));
            AbsoluteLayout.SetLayoutFlags(label, AbsoluteLayoutFlags.YProportional);

            TaskListView.Footer = absoluteLayout;

the footer does not appear but I think it should
Comment 1 Rui Marinho 2016-01-28 16:55:28 UTC
It happens in windows and iOS, works fine on Android
Comment 2 Jimmy [MSFT] 2017-01-20 00:27:23 UTC
Created attachment 19410 [details]
repro project

This is still not working properly on Windows and iOS with Forms 2.3.4-pre1. On iOS, the footer appears but subsequent toggling will cause an NRE to be thrown. I've filed a new report for this since it is a different issue than this report: bug 51652.

On Windows, the footer will not appear the first time it is added but subsequent toggling will cause it to be visible. I've attached a repro project to demonstrate this.

### Steps to reproduce issue on Windows
1. Run the Windows 8.1 or UWP project
2. Press the "Toggle Footer" button
3. Repeat pressing the button

### Expected Results
The footer should be added after the first button press and then hidden on the second press.

### Actual Results
The footer is _not_ visible after the first button press. But it appears after the second press. Subsequent presses result in it being toggled. However if you debug which line is being called when the footer appears/disappears it's actually not doing what is expected. For example, after the second button press, the line of code executed is 

> myLV.Footer = null;

but still the footer appears in the app. Pressing the button again executes

>  myLV.Footer = footer;

but the footer then disappears.

### Version info
Reproduced with Forms and Forms 2.3.4-pre1
Comment 3 Alan Anderson 2017-04-06 18:05:12 UTC
I can't bind an Image Source in a ListView footer, take the exact same XAML put it in the StackLayout following the ListView and it works perfectly. It never even calls the bound property while in the ListView footer. Can hardwire the text in the footer for the image source and all works well.

Using, I'll update to and see if it works.

Comment 4 David Ortinau [MSFT] 2017-08-30 16:30:03 UTC
Confirmed iOS displays the footer and can be toggled repeatedly without NRE (other bug report).

Marking this for re-test in UWP.

@Alan, your issue is not applicable to this specific report. If this is still happening for you, please open a new report and provide a project that demonstrates the behavior. I searched here and couldn't find another report that was a duplicate of your report.
Comment 5 Paul DiPietro [MSFT] 2017-12-07 17:52:39 UTC
Checked against 2.5 and it seems like the first click doesn't enable it as the description above mentions.