Created
June 5, 2018 10:05
-
-
Save ionoy/80fd93d5d6c027c3fb5e0362be37fefc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyView : View, IElementController | |
{ | |
public static BindableProperty HostedPageProperty = BindableProperty.Create("HostedPage", typeof(Page), typeof(MyView), propertyChanged: OnHostedPageChanged); | |
ReadOnlyCollection<Element> _logicalChildrenInner = new ReadOnlyCollection<Element>(new List<Element>()); | |
ReadOnlyCollection<Element> IElementController.LogicalChildren => _logicalChildrenInner; | |
public void SetHostedPage(Page page) | |
{ | |
_logicalChildrenInner = new ReadOnlyCollection<Element>(new List<Element>(new[] { page } )); | |
} | |
private static void OnHostedPageChanged(BindableObject bindable, object oldValue, object newValue) | |
{ | |
var myView = (MyView)bindable; | |
myView.SetHostedPage((Page)newValue); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment