summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core
diff options
context:
space:
mode:
authorJonathan Peppers <jonathan.peppers@gmail.com>2016-08-30 12:59:32 -0500
committerJason Smith <jason.smith@xamarin.com>2016-08-30 10:59:32 -0700
commit0bc22bda64afedbca09416cdccc77ce4ddbe522d (patch)
treeedb80d62df02eb983344c39f3c98d4320a5e4481 /Xamarin.Forms.Core
parent974705b9a920e71ecaa9f5e0d58cf6d80a1d71cf (diff)
downloadxamarin-forms-0bc22bda64afedbca09416cdccc77ce4ddbe522d.tar.gz
xamarin-forms-0bc22bda64afedbca09416cdccc77ce4ddbe522d.tar.bz2
xamarin-forms-0bc22bda64afedbca09416cdccc77ce4ddbe522d.zip
Fix for ListView BindingContext for Header/Footer (#312)
* ListView - unit test showing BindingContext issue Apparently the BC doesn't pass to Header and Footer * ListView - support for passing BC to header and footer * ListView - test checking BindingContext is set Checking that it works to set the BindingContext first and the Header/Footer after
Diffstat (limited to 'Xamarin.Forms.Core')
-rw-r--r--Xamarin.Forms.Core/ListView.cs19
1 files changed, 19 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core/ListView.cs b/Xamarin.Forms.Core/ListView.cs
index fa9f738e..dcc13e69 100644
--- a/Xamarin.Forms.Core/ListView.cs
+++ b/Xamarin.Forms.Core/ListView.cs
@@ -87,6 +87,25 @@ namespace Xamarin.Forms
set { SetValue(FooterTemplateProperty, value); }
}
+ protected override void OnBindingContextChanged()
+ {
+ base.OnBindingContextChanged();
+
+ object bc = BindingContext;
+
+ var header = Header as Element;
+ if (header != null)
+ {
+ SetChildInheritedBindingContext(header, bc);
+ }
+
+ var footer = Footer as Element;
+ if (footer != null)
+ {
+ SetChildInheritedBindingContext(footer, bc);
+ }
+ }
+
public BindingBase GroupDisplayBinding
{
get { return _groupDisplayBinding; }