Hi,
I did try to have my converter return an ObservableCollection<string> as shown below:
public class EnumToCollectionConverter : IValueConverter, IMarkupExtension
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return new ObservableCollection<string>(Enum.GetNames(typeof(Gender)));
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
public object ProvideValue(IServiceProvider serviceProvider)
{
return this;
}
}
XAML fragment for the DataForm is as follow:
<dataForm:DataFormPickerItem
Name="Gender"
BindingContext="{Binding Source={x:Reference viewBindingContext}, Path=BindingContext}"
Editor="Picker"
ItemsSource="{Binding Path=Gender, Converter={conv:EnumToCollectionConverter}}"
LabelText="{x:Static res:Strings.AthleteGenderFieldName}" />
However this does not work as it seems that the EnumToCollectionConverter never gets called.
Can you supply an example with a converter instead of just binding directly to an ObservableCollection?
Thanks again,
JMD