I have a list with a converter like so
<ListView ItemsSource="{Binding Availability, Converter={StaticResource AvailabilityConverter}}">
<ListView.ItemTemplate>
<DataTemplate>
<ContentView>
<ContentView.Content>
<StackLayout>
<Label Text="{Binding DateTime.TimeOfDay}" />
</StackLayout>
</ContentView.Content>
</ContentView>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Here is the converter
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is IEnumerable<Availability>)
{
var availability = (List<Availability>)value;
foreach (var day in availability)
{
//Manipulate the list in here
}
return availability;
}
return value;
}
Availability is a list of DateTimes
I want to be able to write some business logic in the converter to manipulate the list in here before returning it however i get a System.InvalidCastException when it executed.