【发布时间】:2021-02-22 05:08:13
【问题描述】:
在我的 Xamarin 应用程序中,我尝试在 xml 中使用 Ellipse,但它返回了错误:
在 xmlns 中找不到类型 Ellipse
http://xamarin.com/schemas/2014/forms
文档: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>
【问题讨论】:
-
您使用的是哪个表单版本?另外,您是否启用了 Experimental 标志?
-
@MihailDuchev 通过表单版本你的意思是
xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"?? -
不,实验标志未启用..
-
您必须在 App.cs 文件中设置标志 public App() { Device.SetFlags(new[] {"Shapes_Experimental", "Brush_Experimental"});初始化组件() }
-
@IngmarBergman 我已将此作为答案。如果回复有帮助,请采纳为答案并点赞
标签: c# .net xaml xamarin xamarin.forms