SuaveControls.MaterialFormControls
SuaveControls.MaterialFormControls copied to clipboard
Exception : Type views:BorderlessEntry not found in xmlns clr-namespace:SuaveControls.MaterialForms
I was trying to use the MaterialEntry in Xamarin Form project. I created a custom control which inherit MatrialEntry to set the default AccentColor.
public class MyMaterialEntry : MaterialEntry
{
public MyMaterialEntry()
{
this.AccentColor = (Color)App.Current.Resources["AccentColor"];
}
}
Then I use MyMaterialEntry in XAML and run the Android client. Then exception throw.
06-07 11:50:41.141 E/mono-rt (22891): [ERROR] FATAL UNHANDLED EXCEPTION: Xamarin.Forms.Xaml.XamlParseException: Position 13:14. Type views:BorderlessEntry not found in xmlns clr-namespace:SuaveControls.MaterialForms
06-07 11:50:41.141 E/mono-rt (22891): at Xamarin.Forms.Xaml.CreateValuesVisitor.Visit (Xamarin.Forms.Xaml.ElementNode node, Xamarin.Forms.Xaml.INode parentNode) [0x00040] in D:\a\1\s\Xamarin.Forms.Xaml\CreateValuesVisitor.cs:50
06-07 11:50:41.141 E/mono-rt (22891): at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x000ac] in D:\a\1\s\Xamarin.Forms.Xaml\XamlNode.cs:149
06-07 11:50:41.141 E/mono-rt (22891): at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00079] in D:\a\1\s\Xamarin.Forms.Xaml\XamlNode.cs:145
06-07 11:50:41.141 E/mono-rt (22891): at Xamarin.Forms.Xaml.RootNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00044] in D:\a\1\s\Xamarin.Forms.Xaml\XamlNode.cs:200
06-07 11:50:41.141 E/mono-rt (22891): at Xamarin.Forms.Xaml.XamlLoader.Visit (Xamarin.Forms.Xaml.RootNode rootnode, Xamarin.Forms.Xaml.HydrationContext visitorContext) [0x00054] in D:\a\1\s\Xamarin.Forms.Xaml\XamlLoader.cs:140
06-07 11:50:41.141 E/mono-rt (22891): at Xamarin.Forms.Xaml.XamlLoader.Load (System.Object view, System.String xaml) [0x00058] in D:\a\1\s\Xamarin.Forms.Xaml\XamlLoader.cs:89
06-07 11:50:41.141 E/mono-rt (22891): at Xamarin.Forms.Xaml.XamlLoader.Load (System.Object view, System.Type callingType) [0x00026] in D:\a\1\s\Xamarin.Forms.Xaml\XamlLoader.cs:67
06-07 11:50:41.141 E/mono-rt (22891): at Xamarin.Forms.Xaml.Extensions.LoadFromXaml[TXaml] (TXaml view, System.Type callingType) [0x00000] in D:\a\1\s\Xamarin.Forms.Xaml\ViewExtensions.cs:36
06-07 11:50:41.141 E/mono-rt (22891): at SuaveControls.MaterialForms.MaterialEntry.InitializeComponent () [0x00000] in <2e979f815d6a4604a84fcc9b7c5e80c5>:0
06-07 11:50:41.141 E/mono-rt (22891): at SuaveControls.MaterialForms.MaterialEntry..ctor () [0x00006] in <2e979f815d6a4604a84fcc9b7c5e80c5>:0
06-07 11:50:41.141 E/mono-rt (22891): at NWCMobileApp.UserControl.BasicControl.MyMaterialEntry..ctor () [0x00000] in C:\Users\jimmypun\source\repos\NWCMobileApp\NWCMobileApp\NWCMobileApp\UserControl\BasicControl\MyMaterialEntry.cs:11
06-07 11:50:41.141 E/mono-rt (22891): at NWCMobileApp.Pages.Account.LoginPage.InitializeComponent () [0x00067] in C:\Users\jimmypun\source\repos\NWCMobileApp\NWCMobileApp\NWCMobileApp\obj\Debug
etstandard2.0\Pages\Account\LoginPage.xaml.g.cs:42
In MainActivity.cs, I added the Init before/after Forms.Init, but still no luck
SuaveControls.MaterialForms.Android.Renderers.BorderlessEntryRenderer.Init();
SuaveControls.MaterialForms.Android.RendererInitializer.Init();
But the control works if I directly use the MaterialEntry directly in XAML
That's a new one. I guess I never tried inheriting from MaterialEntry
either. What are your linker settings and what Xamarin.Forms version?
What do you mean about linker settings? For XF version, I am using the latest 3.0 version.
There is another issue about MaterialButton.
// we need to reset the StateListAnimator to override the setting of Elevation on touch down and release.
Control.StateListAnimator = new Animation.StateListAnimator();
In your source code of Android Renderer of Material button, above line will throw exception and crash the app on some Android device with low version, eg, Mine is 4.4.4
If you go to your Android and iOS project settings and go to linker there is a setting there. I want to see if it is getting linked out for some reason.
Also good call on the StateListAnimator
. I believe someone has already picked up working on that
The linker settings is none.
I try to do the same but I couldn't. Is there a fix for this?
Any update or workaround for this error?