I started playing a bit with Xamarin DataPages
.
I followed the instructions from this page, and everything compiled, but when I started the application I got a XamlParseException
upon instanciateing the datapage (new SessionDataPage();
) :
Position 7:15. No Property of name StyleClass found
I'm aware that Datapages
are still in the preview channel, but still - this should work.
Xaml:
<?xml version="1.0" encoding="utf-8" ?>
<p:ListDataPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:p="clr-namespace:Xamarin.Forms.Pages;assembly=Xamarin.Forms.Pages"
x:Class="HoloTour.Pages.SessionDataPage"
StyleClass="Events" Title="Sessions" >
<p:ListDataPage.DataSource>
<p:JsonDataSource Source="http://demo3143189.mockable.io/sessions" />
</p:ListDataPage.DataSource>
</p:ListDataPage>
StackTrace:
at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.SetPropertyValue(Object xamlelement, XmlName propertyName, Object value, BindableObject rootElement, INode node, HydratationContext 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.RootNode.Accept(IXamlNodeVisitor visitor, INode parentNode) at Xamarin.Forms.Xaml.XamlLoader.Load(BindableObject view, String xaml) at Xamarin.Forms.Xaml.XamlLoader.Load(BindableObject view, Type callingType) at Xamarin.Forms.Xaml.Extensions.LoadFromXaml[TView](TView view, Type callingType) at HoloTour.Pages.SessionDataPage.InitializeComponent() at HoloTour.Pages.SessionDataPage..ctor() at HoloTour.App..ctor() at HoloTour.UWP.MainPage..ctor() at HoloTour.UWP.HoloTour_UWP_XamlTypeInfo.XamlTypeInfoProvider.Activate_4_MainPage() at HoloTour.UWP.HoloTour_UWP_XamlTypeInfo.XamlUserType.ActivateInstance()
If i remove the StyleClass
from the Xaml file I get a TypeLoadException
:
Method 'CanConvertFrom' in type 'Xamarin.Forms.Pages.JsonSourceConverter' from assembly 'Xamarin.Forms.Pages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
It turns out that the issue was with the references to Xamarin.Forms
and Xamarin.Forms.Pages
.
Initially, I have installed the nuget packages as described in the manual using the following commands:
Get-Project -all | Install-Package Xamarin.Forms.Pages -Version 2.3.0.107
Get-Project -all | Install-Package Xamarin.Forms.Theme.Base -Pre
Get-Project -all | Install-Package Xamarin.Forms.Theme.Light -Pre
After this did not work - I went into the Manage Packages for Solution
(Right click on Solution -> Manage NuGet Packages for Solution), and updated the packages to the latest version.
I'm sure this is something that will be resolved once DataPages
are no longer in the preview channel