Skip to content

Commit cf2e554

Browse files
committed
Fix logic for 'at least one' item
We only show global header/footer if there's at least one item to display. The header was fine already, but we weren't considering other cases where there were items found in order to decide to display the footer. So if you had no header visible, but wanted a footer, it wouldn't show up.
1 parent 4eb498f commit cf2e554

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

VirtualListView/PositionalViewSelector.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ int GetTotalCount()
3333

3434
var sum = 0;
3535

36-
var hasAtLeastOneItem = false;
36+
//var hasAtLeastOneItem = false;
3737
var numberOfSections = Adapter.GetNumberOfSections();
3838

3939
if (HasGlobalHeader && numberOfSections > 0)
@@ -50,7 +50,6 @@ int GetTotalCount()
5050
// If we found one, we can stop looping
5151
// since we just care to calculate a spot
5252
// for the header cell if the adapter isn't empty
53-
hasAtLeastOneItem = true;
5453
break;
5554
}
5655
}
@@ -72,7 +71,7 @@ int GetTotalCount()
7271

7372
// Only count footer if there is already at least one item
7473
// otherwise the adapter is empty and we shouldn't count it
75-
if (HasGlobalFooter && hasAtLeastOneItem)
74+
if (HasGlobalFooter && sum > 0)
7675
sum += 1;
7776

7877
return sum;

0 commit comments

Comments
 (0)