Adding valueconverter to application resources

Ryan-vd-WRyan-vd-W ✭✭NLUniversity ✭✭

I am using this xaml code to add valueconverters to my contentpage

<ContentPage.Resources>
    <ResourceDictionary>
        <vc:StringIsNullOrEmptyToBoolConverter x:Key="vcHasValue" />
        <vc:BooleanNegationConverter x:Key="vcNot" />
    </ResourceDictionary>
</ContentPage.Resources>

Now I'd like to share those on all my xaml pages and the Application.Resources felt like the way to go. Like so

<Application.Resources>
    <ResourceDictionary>
        <vc:StringIsNullOrEmptyToBoolConverter x:Key="vcHasValue" />
        <vc:BooleanNegationConverter x:Key="vcNot" />
    </ResourceDictionary>
</Application.Resources>

However this doesn't seem to work. At least at runtime the the StaticResource can not be found. Am I going about this wrong or am I forgetting something.

In both cases I am using it in my page like so:

IsVisible="{Binding Message, Converter={StaticResource vcHasValue}}"
Sign In or Register to comment.