Depending on where you're exposing the countries collection there are a few different options.
If countries exists in Address or some other ViewModel object you change your converter to implement IMultiValueConverter instead of IValueConverter and then use a MultiBinding to pass both CountryCode and countries (exposed as a property). You would then access and cast values[0] and values[1] to use them to do the lookup in the Convert method.
<TextBlock>
<TextBlock.Text>
<MultiBinding Converter="{StaticResource CountryNameLookupConverter}">
<Binding Path="CountryCode" />
<Binding Path="Countries" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
If you are exposing countries statically (i.e. Lookup.Countries), you can pass the collection to your IValueConverter either as a property or through the ConverterParameter. Here's the converter with a property:
public class CountryNameLookupConverter : IValueConverter
{
public IEnumerable<Country> LookupList { get; set; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Country country = LookupList.FirstOrDefault(c => c.Code.Equals(value));
if (country == null)
return "Not Found";
return country.Name;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return Binding.DoNothing;
}
}
and the converter resource would be declared like:
<local:CountryNameLookupConverter x:Key="CountryNameLookupConverter" LookupList="{x:Static local:Lookup.Countries}"/>
Or to pass into Convert's object parameter instead:
<TextBlock Text="{Binding Path=CountryCode, Converter={StaticResource CountryNameLookupConverter}, ConverterParameter={x:Static local:Lookup.Countries}}" />