xaml - 属性内容为null或IEnumerable

标签 xaml xamarin xamarin.forms

我在Xamarin.Forms中有一个测试页,它使我得到此错误,我该如何解决?

Property Content is null or is not IEnumerable



Xaml:
<?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="Project1.Page1">
<ContentPage.Content>
    <Label Text="Page"></Label>
    <Editor Text="I am an Editor" />
  </ContentPage.Content>
</ContentPage>

最佳答案

Content属性的类型为View。您不能对此有两个 View 。替换为

<StackLayout >
    <Label Text="Page"></Label>
    <Editor Text="I am an Editor" />
<StackLayout>

关于xaml - 属性内容为null或IEnumerable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38099252/

相关文章:

Xamarin.Forms 目录选取器

xamarin - 在Xamarin Forms Shared Project中将return更改为next/done键

android - 无法构建 Xamarin Android 项目 : An outdated of 'Android SDK Build-tools' is in use

c# - 如何在多边形内旋转位图?

c# - 将文本 block 的可见性属性绑定(bind)到 Stack.Any

c# - 使用 mvvm 在 xamarin 上绑定(bind)数据收集

c# - 如何在 Xamarin C# 中使用 setCompoundDrawables

c# - 如何在 UserControl 中使用 ContentPresenter

WPF 绑定(bind)到样式中另一个属性的绑定(bind)

android - obj/Debug/android/src/{name space} 的目录名是 MD5 哈希吗?