Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Generic subclassing from XAML

$
0
0

I am using generic subclassing in XAML with x:TypeArguments.
So far it is working great !

The only problem I have is that when I use a ValueConverter from a StaticResource declared in the Resources, then I get a XAML parser exception when it tries to load the "Type". I know the ValueConverter is fine and it gets added to the Resource dictionary.

I get an exception of type 'Xamarin.Forms.Xaml.XamlParseException' occurred in Xamarin.Forms.Xaml.DLL
The Message is: Type vw:PageBase not found in xmlns clr-namespace:App.Mobile.Views;assembly=App.Mobile
This happens at the following location in the Stack Trace:
at Xamarin.Forms.Xaml.XamlParser.GetElementType(XmlType xmlType, IXmlLineInfo xmlInfo)
at Xamarin.Forms.Xaml.StaticResourceExtension.LookupNamedResource(INode node, String key)

I think it is not considering the x:TypeArguments when it is trying to find the base generic type.

<vw:PageBase.Resources>
    <ResourceDictionary>
      <cnv:StatusToTextConverter x:Key="cnvStatus" />
    </ResourceDictionary>
  </vw:PageBase.Resources>

 <Label Text="{Binding Status_Id, Converter={StaticResource cnvStatus}}"></Label>

Any solution? Can I maybe hook onto or override the Xamarin.Forms.Xaml.StaticResourceExtension to consider the Type ?


Viewing all articles
Browse latest Browse all 58056

Trending Articles