void OnHeaderOrFooterChanged(ref Element storage, string property, object dataObject, DataTemplate template, bool templateChanged) { if (dataObject == null) { if (!templateChanged) { OnPropertyChanging(property); storage = null; OnPropertyChanged(property); } return; } if (template == null) { var view = dataObject as Element; if (view == null || view is Page) { view = new Label { Text = dataObject.ToString() } } ; view.Parent = this; OnPropertyChanging(property); storage = view; OnPropertyChanged(property); } else if (storage == null || templateChanged) { OnPropertyChanging(property); storage = template.CreateContent() as Element; if (storage != null) { storage.BindingContext = dataObject; storage.Parent = this; } OnPropertyChanged(property); } else { storage.BindingContext = dataObject; } }
public static void OnViewTemplateChanged( DataTemplate newViewTemplate, ref View localViewRef, object currentViewData, Action <Element> OnChildRemoved, Action <Element> OnChildAdded, Shell shell) { View newContentView = currentViewData as View; if (newViewTemplate != null) { newContentView = (View)newViewTemplate.CreateContent(newViewTemplate, shell); } SetView(ref localViewRef, newContentView, OnChildRemoved, OnChildAdded); }