Beispiel #1
0
        public void OnContentPageApplyTemplateShouldBeCalled()
        {
            var xaml = @"<ContentPage
					xmlns=""http://schemas.microsoft.com/dotnet/2021/maui""
					xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
					x:Class=""Microsoft.Maui.Controls.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);
        }
Beispiel #2
0
        public void GetContentPageTemplateChildShouldWork()
        {
            var xaml = @"<ContentPage
					xmlns=""http://schemas.microsoft.com/dotnet/2021/maui""
					xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
					x:Class=""Microsoft.Maui.Controls.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);
        }