我无法在页面的axml
文件中添加自定义条目。我正在复制并粘贴此tutorial的代码。
自定义控制:
namespace MyApp
{
public class MyEntry : Entry
{
public MyEntry()
{
BackgroundColor = Color.Gray;
}
}
}
XAML:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MyApp;assembly=MyApp"
x:Class="MyApp.Teste">
<Label Text="teste" VerticalOptions="Center" HorizontalOptions="Center" />
<local:MyEntry x:Name="Entry" Text="In Shared Code" />
</ContentPage>
App.cs:
MainPage = new Teste();
我收到了这个错误:
56:43.847 E / mono(3346):未处理例外:05-06 17:56:43.847 E / mono(3346):System.IO.FileNotFoundException:无法加载 文件或程序集“MyApp”或其依赖项之一05-06 17:56:43.847 E / mono(3346):文件名:'MyApp'05-06 17:56:43.847 E / mono( 3346):at(包装器动态方法) System.Object的:99831900-fb04-4a45-85f3-99b1198ac963 (intptr,intptr,intptr)05-06 17:56:43.847 E / mono(3346):at (包装器本机到托管) System.Object的:99831900-fb04-4a45-85f3-99b1198ac963 (intptr,intptr,intptr)05-06 17:56:43.847 E / mono-rt(3346):[ERROR] 致命的不受欢迎的异常:System.IO.FileNotFoundException:不能 加载文件或程序集“MyApp”或其依赖项之一05-06 17:56:43.847 E / mono-rt(3346):文件名:'MyApp'05-06 17:56:43.847 E / mono-rt(3346):at(包装动态方法) System.Object的:99831900-fb04-4a45-85f3-99b1198ac963 (intptr,intptr,intptr)05-06 17:56:43.847 E / mono-rt(3346):at (包装器本机到托管) System.Object的:99831900-fb04-4a45-85f3-99b1198ac963 (intptr,intptr,intptr)referenceTable GDEF length = 670 1