tbaggett / xfgloss

New styling properties for standard Xamarin.Forms controls
Other
160 stars 25 forks source link

Type xfg:ContentPageGloss.BackgroundGradient not found #32

Closed nodoid closed 6 years ago

nodoid commented 6 years ago

I'm following the example on the example project, but when I try to compile I get the error that xfg:ContentPageGloss.BackgroundGradient not found in xmlns car-namespace:XFGloss;assembly=XFGloss

My full xaml page is

<?xml version="1.0" encoding="UTF-8"?>

I have XFGloss initialised in both the Android and iOS projects with the target framework set to .NET Standard 2.

I don't have a problem if I'm writing code rather than xaml

pdonovan commented 6 years ago

I'm having the same problem. I've downloaded and built the sample app. That works fine. But as soon as you edit AboutPage.xaml to wrap the xfg:ContentPageGloss.BackgroundGradient in a ContentPage.Content element (common practice on real-world apps) the error appears. I've yet to find a solution.

tbaggett commented 6 years ago

Sorry for the slow reply. My father was ill through most of the summer before passing away at the end of August.

I respectfully disagree that wrapping a page's content in a element is a common practice in real-world apps. I've built a number of commercial apps using Xamarin.Forms, as well as reviewed apps authored by others, and that hasn't been my experience at least. The official ContentPropertyAttribute class documentation also doesn't indicate it is required, or even necessarily recommended/preferred, to be explicitly declared.

In regards to the specific issue you're seeing, it is due to the ContentPage's Content property being declared as type View. You can confirm this by viewing the ContentPage source on GitHub. Therefore, only classes that derive from the View class can be assigned to the ContentPage's Content property.

I hope this info was helpful and, again, apologies that it took so long to reply.