在Xamarin的xmlns中找不到类型Ellipse

问题描述

在我的Xamarin应用程序中,我试图在xml中使用Ellipse,但返回了错误

在xmlns http://xamarin.com/schemas/2014/forms中找不到类型Ellipse

文档:https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/shapes/ellipse

Page.xml

<?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="Osma.Mobile.App.Views.Start" >

    <ContentPage.Content>
        <StackLayout>

            <Ellipse Fill="Red"
                WidthRequest="150"
                HeightRequest="50"
                HorizontalOptions="Start" />

        </StackLayout>
    </ContentPage.Content>
</ContentPage>

解决方法

您将必须在App.cs文件中设置标志

public App() 
{ 
     Device.SetFlags(new[] {"Shapes_Experimental","Brush_Experimental"}); 
     InitializeComponent() 
}