1
votes

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.


Additional Information:

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>

enter image description here

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()

Edit:

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.

1
Did you tried to run an example from them? Look up here: blog.xamarin.com/scaffolding-xamarin-forms-pages-with-datapages - jzeferino
@jzeferino Thanks for your comment. I'll take a look as soon as I get a chance and will update about results. - Avi Turner
@jzeferino the instructions in your link are same as in the link I have posted. However, I did notice that the error I have posted was misleading - it was another error I got while attempting to investigate. I have edited the question to reflect the actual issue. - Avi Turner
@jzeferino Thanks again for your comment. I started going over the code, and Indeed did not saw a data member of StyleClass neither in the Datapage nor in the `ContentPage' class. However, until I download the source code and go over it in an IDE, I suspect I might be missing something... As for resolving the issue - Nothing so far... - Avi Turner

1 Answers

0
votes

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


enter image description here enter image description here