Xamarin.Forms XAML - Adding Custom Controls

Xamarin Forms in VS 2017. Recent Xamarin Forms.

Following this blog https://blog.xamarin.com/adding-bindable-native-views-directly-to-xaml/?utm_medium=social&utm_campaign=blog&utm_source=twitter&utm_content=xaml-bindable-native-views I added plain text for Android to page, but it does not appear.

Did I miss something?

<?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>
+4
source share
1 answer

You can't seem to do this if you have XAMLC compilation (XAML) enabled. As soon as I turned off the work,

XamlC . x: Name

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

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

+5

Source: https://habr.com/ru/post/1679911/


All Articles