Added a stylesheet and at runtime on UWP I get the error below.
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Latest"
x:Class="Latest.MainPage">
<ContentPage.Resources>
<StyleSheet Source="Main.css"/>
</ContentPage.Resources>
<Label Text="Welcome to Xamarin.Forms!"
VerticalOptions="Center"
HorizontalOptions="Center" />
</ContentPage>
Main.css:
^ContentPage {
background-color: #ff6a00;
}
I see an orange bg.
Runtime error.
Xamarin.Forms.Xaml.XamlParseException
HResult=0x80131500
Message=Position 7:21. Cannot assign property "Source": Property does not exist, or is not assignable, or mismatching type between value and property
Source=Xamarin.Forms.Xaml
StackTrace:
at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.SetPropertyValue(Object xamlelement, XmlName propertyName, Object value, Object rootElement, INode node, HydrationContext context, IXmlLineInfo lineInfo)
at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.Visit(ValueNode node, INode parentNode)
at Xamarin.Forms.Xaml.ValueNode.Accept(IXamlNodeVisitor visitor, INode parentNode)
at Xamarin.Forms.Xaml.ElementNode.Accept(IXamlNodeVisitor visitor, INode parentNode)
at Xamarin.Forms.Xaml.RootNode.Accept(IXamlNodeVisitor visitor, INode parentNode)
at Xamarin.Forms.Xaml.XamlLoader.Visit(RootNode rootnode, HydrationContext visitorContext)
at Xamarin.Forms.Xaml.XamlLoader.Load(Object view, String xaml)
at Xamarin.Forms.Xaml.XamlLoader.Load(Object view, Type callingType)
at Xamarin.Forms.Xaml.Extensions.LoadFromXaml[TXaml](TXaml view, Type callingType)
at Latest.MainPage.InitializeComponent() in C:\Users\dave\Source\Repos\Latest\Latest\Latest\obj\Debug\netstandard2.0\MainPage.xaml.g.cs:line 21
at Latest.MainPage..ctor() in C:\Users\dave\Source\Repos\Latest\Latest\Latest\MainPage.xaml.cs:line 14
at Latest.App..ctor() in C:\Users\dave\Source\Repos\Latest\Latest\Latest\App.xaml.cs:line 16
at Latest.UWP.MainPage..ctor() in C:\Users\dave\Source\Repos\Latest\Latest\Latest.UWP\MainPage.xaml.cs:line 24
at Latest.UWP.Latest_UWP_XamlTypeInfo.XamlTypeInfoProvider.Activate_4_MainPage() in C:\Users\dave\Source\Repos\Latest\Latest\Latest.UWP\obj\x86\Debug\XamlTypeInfo.g.cs:line 255
at Latest.UWP.Latest_UWP_XamlTypeInfo.XamlUserType.ActivateInstance() in C:\Users\dave\Source\Repos\Latest\Latest\Latest.UWP\obj\x86\Debug\XamlTypeInfo.g.cs:line 476
Confirmed it works on Android in this same solution fwiw.
Inline css worked on UWP.
<StyleSheet>
<![CDATA[
^contentpage {
background-color: blue;
}
]]>
</StyleSheet>
works with XamlC on
Is vNext+1 version 3? This is a blocker for using CSS in UWP, could it be moved up to version 3 and a pre-4 built?
Thanks!
@stevehurcombe
does the fix in #1657 works for you ? I haven't had time yet to come back to actually testing it
I'm afraid I don't know. If there is an "easy" way to get a build with it in I'd be happy to try it.
This is a green field project, so there's not much other code to mask things!
Should I grab it from here? I know that's got everything else in it too...
https://myget.org/feed/xamarinforms-ci/package/nuget/Xamarin.Forms
no, the fix isn't present in any released package
OK, so would I be right in thinking that I can download the branch labelled 3.0.0, apply this code change (looks like a one liner) and I'll have the right build?
That was a lot of hoops to jump through to change one line of code, but it worked!
Most helpful comment
That was a lot of hoops to jump through to change one line of code, but it worked!