Hi, I try to format a dateTime in my group template for Telerik Listview in Xamarin Forms.
<ContentPage.Resources> <ResourceDictionary> <converters:HexToColorConverter x:Key="cnvHexToColor"></converters:HexToColorConverter> <converters:DateToGroupeConverter x:Key="cnvDateToGroupe"></converters:DateToGroupeConverter> </ResourceDictionary> </ContentPage.Resources>AND ON THE LISTVIEW <telerikDataControls:RadListView.GroupDescriptors> <telerikListView:PropertyGroupDescriptor PropertyName="DateOnlyPlanif" SortOrder="Ascending" /> </telerikDataControls:RadListView.GroupDescriptors> <telerikDataControls:RadListView.GroupHeaderTemplate> <DataTemplate> <Grid BackgroundColor="#C1C1C1"> <Label Text="{Binding , Converter={StaticResource cnvDateToGroupe}}" TextColor="#303030" FontSize="Medium" HorizontalOptions="Center"/> </Grid> </DataTemplate> </telerikDataControls:RadListView.GroupHeaderTemplate>
But the converter is never called.
public class DateToGroupeConverter : IValueConverter{ public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { try { string retour = ""; DateTime DatePlanifDebut = (DateTime)value; if (DatePlanifDebut == DateTime.MinValue) { retour = "- Aucune date planifiée -"; } else { retour = DatePlanifDebut.Date.ToString("dddd, dd MMMM, yyyy", CultureInfo.CurrentCulture); } return retour; } catch (Exception ex) { ErrorHandling.LogError(ex); return "- Aucune date planifiée -"; } } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); }}
Any idea?
The same converter in an colum of the grid work ok.