示例#1
0
文件: LoaderTests.cs 项目: hevey/maui
        public void TestSetBindingToNonBindablePropertyShouldThrow()
        {
            var xaml = @"
				<View 
				xmlns=""http://schemas.microsoft.com/dotnet/2021/maui""
				xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
				x:Class=""Microsoft.Maui.Controls.Xaml.UnitTests.CustomView"" 
				Name=""customView"" 
				NotBindable=""{Binding text}""
				/>"                ;

            var view = new CustomView();

            Assert.Throws(new XamlParseExceptionConstraint(6, 5), () => view.LoadFromXaml(xaml));
        }
示例#2
0
文件: LoaderTests.cs 项目: hevey/maui
        public void TestRootName()
        {
            var xaml = @"
				<View
				xmlns=""http://schemas.microsoft.com/dotnet/2021/maui""
				xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
				x:Class=""Microsoft.Maui.Controls.Xaml.UnitTests.CustomView"" 
				x:Name=""customView"" 
				/>"                ;

            var view = new CustomView();

            view.LoadFromXaml(xaml);

            Assert.AreSame(view, ((Maui.Controls.Internals.INameScope)view).FindByName("customView"));
        }
示例#3
0
文件: LoaderTests.cs 项目: hevey/maui
        public void ThrowOnMissingXamlResource()
        {
            var view = new CustomView();

            Assert.Throws(new XamlParseExceptionConstraint(), () => view.LoadFromXaml(typeof(CustomView)));
        }