I'm trying to create a button renderer. I followed the custom renderer for an entry found here:
The solution is build using PLC.
Am I using the wrong assemblies?
More info on error:
Xamarin.Forms.Xaml.XamlParseException was thrown
Type local:MyButton not found in xmlns:local="clr-namespace:MyApp;assembly=MyApp"
https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/custom-renderer/entry/
and I get a xaml parse exception error.
<?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:local="clr-namespace:MyApp;assembly=MyApp"
x:Class="MyApp.LoginPage"
BackgroundColor="White">
<StackLayout>
<local:MyButton
Text="Login"
TextColor="Blue"
BackgroundColor="Transparent"
HorizontalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage>
Android Renderer:
using Xamarin.Forms.Platform.Android;
using Xamarin.Forms;
using DeliveryTracker;
using DeliveryTracker.Droid;
[assembly: ExportRenderer(typeof(MyButton), typeof(MyButtonRenderer))]
namespace MyApp.Droid
{
class MyButtonRenderer : ButtonRenderer
{
protected override void OnDraw(Android.Graphics.Canvas canvas)
{
base.OnDraw(canvas);
}
}
}
In Forms:
using System;
using Xamarin.Forms;
namespace MyApp
{
public class MyButton : Button
{
public MyButton()
{
}
}
}
";assembly=MyApp"part in your namespace declarations, so justxmlns:local="clr-namespace:MyApp". Did you by any change rename your project or namespaces or something? Make sure your namespace in the XAML is the same as where your control is declared. - Gerald Versluis