Xaml Xamarin 中的错误:未找到所有类型
Xaml errors in Xamarin: all types not found
我在 Adobe XD 上设计了一个 Android 应用程序,并通过一个插件将我的所有资产导出到 XAML。
我在 Xamarin 上创建了一个新项目,并立即将生成的 XAML 粘贴到 stacklayout 中的 MainPage.xaml 文件中。所以像下面这样:
<stacklayout>
<Grid Uid="Google Pixel 6 Pro – 1" Width="412" Height="778" Background="#0000" ClipToBounds="True" >
<Border Width="225" Height="43" BorderBrush="#0000" Margin="171,18,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" />
<Canvas Width="36" Height="30" Margin="24,24,0,0" HorizontalAlignment="Left" VerticalAlignment="Top">
<Border Width="24" Height="24" BorderBrush="#FFFF" Canvas.Left="5" Canvas.Top="6" />
....
问题是我在布局中粘贴的任何内容都会给我以下错误消息:
The type 'border' was not found. verify that you are not missing an
assembly reference and that all referenced assemblies have been built.
Xaml0414: namespace is missing
我为每个组件都得到了这个。边框、canvas、文本块,甚至像 uid.
这样的子参数
这是我在顶部的内容
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="DemoXAML.MainPage">
我不太确定我错过了什么
问题是您使用的这个代码转换器确实将您的代码转换为 XAML,但是 XAML 是 WPF 而不是 Xamarin.Forms(是的,并非它们之间的所有内容都是相同)。
<Border Width="225" Height="43" BorderBrush="#0000" Margin="171,18,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" />
WPF XAML 不是 Xamarin,最接近它的是你使用 Xamarin.Forms Frame 但它们不一样。
在两者之间进行一些谷歌搜索会有帮助。
我在 Adobe XD 上设计了一个 Android 应用程序,并通过一个插件将我的所有资产导出到 XAML。
我在 Xamarin 上创建了一个新项目,并立即将生成的 XAML 粘贴到 stacklayout 中的 MainPage.xaml 文件中。所以像下面这样:
<stacklayout>
<Grid Uid="Google Pixel 6 Pro – 1" Width="412" Height="778" Background="#0000" ClipToBounds="True" >
<Border Width="225" Height="43" BorderBrush="#0000" Margin="171,18,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" />
<Canvas Width="36" Height="30" Margin="24,24,0,0" HorizontalAlignment="Left" VerticalAlignment="Top">
<Border Width="24" Height="24" BorderBrush="#FFFF" Canvas.Left="5" Canvas.Top="6" />
....
问题是我在布局中粘贴的任何内容都会给我以下错误消息:
The type 'border' was not found. verify that you are not missing an assembly reference and that all referenced assemblies have been built. Xaml0414: namespace is missing
我为每个组件都得到了这个。边框、canvas、文本块,甚至像 uid.
这样的子参数这是我在顶部的内容
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="DemoXAML.MainPage">
我不太确定我错过了什么
问题是您使用的这个代码转换器确实将您的代码转换为 XAML,但是 XAML 是 WPF 而不是 Xamarin.Forms(是的,并非它们之间的所有内容都是相同)。
<Border Width="225" Height="43" BorderBrush="#0000" Margin="171,18,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" />
WPF XAML 不是 Xamarin,最接近它的是你使用 Xamarin.Forms Frame 但它们不一样。
在两者之间进行一些谷歌搜索会有帮助。