public void OnContentPageApplyTemplateShouldBeCalled() { var xaml = @"<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms"" xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml"" x:Class=""Xamarin.Forms.Core.UnitTests.MyTestContentPage""> <ContentPage.ControlTemplate> <ControlTemplate> <Label x:Name=""label0""/> </ControlTemplate> </ContentPage.ControlTemplate> </ContentPage>" ; var contentPage = new MyTestContentPage(); contentPage.LoadFromXaml(xaml); Assert.IsTrue(contentPage.WasOnApplyTemplateCalled); }
public void GetContentPageTemplateChildShouldWork() { var xaml = @"<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms"" xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml"" x:Class=""Xamarin.Forms.Core.UnitTests.MyTestContentPage""> <ContentPage.ControlTemplate> <ControlTemplate> <Label x:Name=""label0""/> </ControlTemplate> </ContentPage.ControlTemplate> </ContentPage>" ; var contentPage = new MyTestContentPage(); contentPage.LoadFromXaml(xaml); IList <Element> internalChildren = contentPage.InternalChildren; Assert.AreEqual(internalChildren[0], contentPage.TemplateChildObtained); }