chustar
chustar

Reputation: 12465

The resource "ResourceName" could not be resolved error in WP8

I'm seeing an error trying to use a custom converter in my WP8 app.

I defined my converter in a namespace: standrighthere.Utilities:

namespace standrighthere.Utilities
{
    public class NonNullVisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return value == null ? Visibility.Collapsed : Visibility.Visible;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}

I then included it in the App.xaml manifest as so:

<Application.Resources>  
    <utilities:NonNullVisibilityConverter x:Key="NonNullVisibiltyConverter" />  
</Application.Resources>

I then tried to use it in my phone application page like this:

<Button Visibility="{Binding Source={Binding User}, Converter={StaticResource ResourceKey=NonNullVisibilityConverter}}" />

However, it keeps giving the error:

Error 1 The resource "NonNonNullVisibilityConverter" could not be resolved.

I feel like I must be missing something really obvious here.

Upvotes: 0

Views: 1174

Answers (1)

Kevin Gosse
Kevin Gosse

Reputation: 39007

Looks like a simple typo. You called your converter "NonNullVisibiltyConverter" in the resources and NonNonNullVisibil*i*tyConverter in the binding.

Upvotes: 1

Related Questions