Permalink
Browse files

Fix for BindingContext in ListView Header or Footer

  • Loading branch information...
Jonathan Peppers
Jonathan Peppers committed Jun 17, 2016
1 parent 4fa3c8c commit d0170a4069739aee53c0186adecffc804a51a7c3
Showing with 32 additions and 1 deletion.
  1. +32 −1 Xamarin.Forms.Core/ListView.cs
@@ -536,5 +536,36 @@ static bool ValidateHeaderFooterTemplate(BindableObject bindable, object value)
var template = (DataTemplate)value;
return template.CreateContent() is View;
}
}
protected override void OnBindingContextChanged()
{
base.OnBindingContextChanged();
//NOTE: BindingContext was not passing through ListView to its Header or Footer
var gotBindingContext = false;
object bc = null;
var header = Header as Element;
if (header != null)
{
bc = BindingContext;
gotBindingContext = true;
SetChildInheritedBindingContext(header, bc);
}
var footer = Footer as Element;
if (footer != null)
{
if (!gotBindingContext)
{
bc = BindingContext;
gotBindingContext = true;
}
SetChildInheritedBindingContext(footer, bc);
}
}
}
}

0 comments on commit d0170a4

Please sign in to comment.