Skip to content

Commit 0e1f96c

Browse files
committed
Use the bindingcontext of listview if item data is null
Use the binding context of the listview parent control in cases where recycling a view's data is null. This is likely going to be the global header/footer and possibly section header/footer too
1 parent 02547a2 commit 0e1f96c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

VirtualListView/Controls/VirtualListView.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,12 @@ public void RecycleView(PositionInfo position, object data, IView view)
322322
{
323323
if (view is View controlsView)
324324
{
325-
controlsView.SetValue(View.BindingContextProperty, data);
325+
// Use the listview's binding context if
326+
// there's no data
327+
// this may happen for global header/footer for instance
328+
controlsView.SetValue(
329+
View.BindingContextProperty,
330+
data ?? this.BindingContext);
326331
}
327332
}
328333

0 commit comments

Comments
 (0)