Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin XLS0502: The type 'Thickness' does not support direct content

I've just started a new Xamarin (Android & iOS) project in VS2019 and have been following this quick start guide to build a sample app.

One of the lines it asks you to add to App.xaml is

<Thickness x:Key="PageMargin">20</Thickness>

However, IntelliSense immediately underlines it with the aforementioned error (error, not warning). Somehow it still builds (I thought errors were supposed to prevent builds?) and works as expected, so the erroneous error message has me confused.

Am I using an outdated parser? I've checked that all the Xamarin Nuget packages are up-to-date, and as stated I'm using Visual Studio 2019 so I don't see why it would have this problem.

Or is there a more modern way of writing this line? The tutorial is only a few months old...

like image 935
Extragorey Avatar asked May 07 '19 23:05

Extragorey


1 Answers

You are trying to define a resource, and you could write this way as well:

<Thickness x:Key="PageMargin" Left="20" Top="20" Right="20" Bottom="20"/>
like image 59
VahidShir Avatar answered Oct 12 '22 22:10

VahidShir