Xamarin.Forms XAML-添加本机控件

伊恩·温克(Ian Vink)

VS 2017中的Xamarin表单。最新的Xamarin表单。

在此博客https://blog.xamarin.com/adding-bindable-native-views-direct-to-xaml/?utm_medium=social&utm_campaign=blog&utm_source=twitter&utm_content=xaml-bindable-native-views后面,我向其中添加了一个简单的Android TextBox页面,但它不会出现。

我想念什么吗?

<?xml version="1.0" encoding="utf-8"?>

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         xmlns:androidWidget="clr-namespace:Android.Widget;assembly=Mono.Android;targetPlatform=Android"
         xmlns:formsandroid="clr-namespace:Xamarin.Forms;assembly=Xamarin.Forms.Platform.Android;targetPlatform=Android"
         xmlns:controls="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin.Abstractions"
         xmlns:widget="clr-namespace:Android.Support.Design.Widget;assembly=Xamarin.Android.Support.Design"
         x:Class="Muffin.MainPage">

<StackLayout> 
     <androidWidget:TextView x:Arguments="{x:Static formsandroid:Forms.Context}" Text="this is the text" />
</StackLayout>
伊恩·温克(Ian Vink)

如果启用了XAMLC(XAML编译),则似乎无法执行此操作。一旦我禁用它就可以了

您不能在具有本机视图的任何页面上启用XamlC。您不能在任何本机视图控件上使用x:Name

//NO NO -> [assembly: XamlCompilation(XamlCompilationOptions.Compile)]

参见:https : //xamarinhelp.com/native-views-xaml-pcl/

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Xamarin Forms Switch XAML

在哪个控件中我可以在 Xamarin.Forms XAML 中添加多个值

关于 Xamarin Forms - Xaml 编译

Xamarin.Forms.Xaml.XamlParseException

将命令绑定到Xamarin.forms Xaml中的本机视图

Xamarin Forms XAML-创建没有UI的自定义控件?

Xamarin.Forms中的XAML绑定问题

Xamarin Forms (Xaml) ListView 不显示图像

xamarin.forms以xaml设置厚度

更改Xamarin Forms XAML按钮的isVisible属性

xamarin.forms从xaml绑定到属性

XAML中的Xamarin.Forms ListView AutoHeight

Xamarin.Forms,XAML,绑定和isVisible

Xamarin.Forms,XAML和XMLNS问题

将 ToolbarItems 添加到 Xamarin.Forms 项目中的 MainPage.xaml.cs

如何使用Xaml在Xamarin Forms中的标签上添加上标

Xamarin.Forms向XAML中的所有条目添加效果

向Zxing条码Xaml内容页面Xamarin.forms添加元素

Xamarin WebViewRenderer.OnElementChanged在Xamarin Forms 2.5上使用null本机控件调用

Xamarin Forms - 从自定义渲染器检查控件是否具有从 XAML 设置的属性

分段控件Xamarin Forms定制

Xamarin.Forms Segoe Icon Code Binding in XAML UWP project Xamarin Native Xaml

我可以在使用 Caliburn.Micro 时将 App.xaml 添加回 Xamarin.Forms 项目吗?

在Xamarin.forms中无法在XAML页面上看到绑定

如何在Xamarin.Forms XAML中绘制路径

Xamarin Forms - 从 Android 特定的 .cs 文件引用 XAML

将图像绑定到URL Xamarin Forms XAML

将XAML元素公开到ViewModel以运行方法Xamarin Forms

带有 xaml 视图和动态内容的 Xamarin Forms Scrollview