When I try and create a content view with XAML in Xamarin Forms the generated code-behind throws this error:
System.ArgumentNullException: Value cannot be null. Parameter name: clrNamespace
at this.LoadFromXaml(typeof(MyXamlPage));
at InitializeComponent()
XAML:
<ContentPage
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Adapt.Presentation.XamarinForms.MyXamlPage"
Title="My Xaml Page">
<ContentPage.Content>
<Grid>
</Grid>
</ContentPage.Content>
</ContentPage>
You just need to add xmlns="http://xamarin.com/schemas/2014/forms" to your root element. This error is thrown because no namespace is defined for your root element, as a result the parser can't determine the type of XML that's being parsed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With