Referencing a static string from an external library in Xaml.

bcafazzobcafazzo USMember ✭✭

When I recently updated from Xamarin.Forms. to Xamarin.Forms. some of my Xaml views have begun failing with an error Object reference not set to an instance of an object. After some finessing I've found that the failing Xaml views are all referencing an external library I wrote containing a list of constant strings. The simplest reproduction I have is as follows:

<?xml version="1.0" encoding="UTF-8"?> <ContentView xmlns="" xmlns:x="" xmlns:constants="clr-namespace:FontAwesome.Constants;assembly=FontAwesome.Constants" x:Class="WexMobile.Core.Controls.OmniMenu.Test"> <ContentView.Content> <Label Text="{x:Static constants:FA.STEP_FORWARD}" /> </ContentView.Content> </ContentView>

If I change the Text property to something else, including a static that exists in the same project, it compiles just fine. FA.STEP_FORWARD is a simple string containing the glyphcode of the FontAwesome "Step Forward" icon.

My assumption is that the FontAwesome constants library cannot be found by the Xaml compiler so it just dies when trying to create it.

Any thoughts on how to go about getting around this?

Sign In or Register to comment.