6 Answers, 1 is accepted
Thank you for contacting us. Could you please tell us more about your scenario? A code snippet, a sample project or anything that could help us reproduce the issue would be appreciated. I look forward to your reply.
Regards,
Rosy Topchiyska
Telerik by Progress
Here's the xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:AcoadApp.ViewModels;assembly=AcoadApp"
xmlns:telerikInput="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"
x:Class="AcoadApp.Views.AddMatchPage"
Title="New Match">
<telerikInput:RadDataForm x:Name="dataForm">
<telerikInput:RadDataForm.Source>
<local:DataSource />
</telerikInput:RadDataForm.Source>
</telerikInput:RadDataForm>
</ContentPage>
Here's the code behind
public partial class AddMatchPage : ContentPage
{
public AddMatchPage()
{
InitializeComponent();
dataForm.RegisterEditor(nameof(DataSource.Date), Telerik.XamarinForms.Input.EditorType.DateEditor);
}
protected override async void OnAppearing()
{
base.OnAppearing();
}
}
And the DataSource file
public class DataSource : INotifyPropertyChanged
{
DateTime _date = DateTime.Now;
[DisplayOptions(Header = "Name")]
public DateTime Date
{
get { return _date; }
set { _date = value; OnPropertyChanged(); }
}
public DataSource() { }
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
var handler = PropertyChanged;
if (handler != null)
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
When going to the page I get the following exception -
Java.Lang.Error: DataFormTextEditor does not support properties of type Calendar. Please specify a value converter for your property.
I guess I need to create a converter for this? I assumed that the control would handle the conversion itself. I looked at the ConverterAttribute example in the docs but don't know how to create one to handle this situation or if I even need to do that.
Thank you for the information. This exception is thrown only when you do not explicitly register a DateEditor for a property of type DateTime, which is not your case. I could not reproduce this issue on our side. Could you please take a look at the attached project and let us know if you get this issue with it?
Regards,
Rosy Topchiyska
Telerik by Progress
It took me awhile to get around to this but I finally tested the sample project and it works fine so it must be something specific to my project or the version of Telerik I'm using. I'll upgrade to the version that is in the sample project and try again.
Thanks,
Edwin