I have this code and it gets me this error, how can I fix this ?
Object of type 'System.String' cannot be converted to type 'Xamarin.Forms.View'.
Xaml :
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Project1.Page1">
<ContentPage.Content>
<StackLayout>
<Label Text="Text"></Label>
Some text here
<Editor Text="I am an Editor" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
This problem has solved when I removed the plain text that is inside the StackLayout. So I have changed it to a label component and have put the plain text in the text property.
This is the working code :
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Project1.Page1">
<ContentPage.Content>
<StackLayout>
<Label Text="Text"></Label>
<Editor Text="I am an Editor" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
Xaml :
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Project1.Page1">
<ContentPage.Content>
<StackLayout>
<Label Text="Text"></Label>
<!--Some text here-->
<Editor Text="I am an Editor" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
Try to do this sir, this way change the text for comment
Regards
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