Some strange behavior from SfDataForm date and time picker controls

Hello, I have a question about the SfDataForm control. I'm trying to use the control for building up a data form. Within the VM there are two bindable properties (one for start date (decorated with DataType.Date) and one for start time (decorated with DataType.Time)). The form renders the expected date and time picker controls.
While debugging, I noticed the following (only for iOS, for Android everything seems to work fine, which I think is strange)
  • After the page is opened, and the form is renderer, the label shows the correct start time (which is 00:00). After tapping on the label of the start time property, the time picker is shown, but the expected default time (00:00) is now shown something like (09:43) O_O
  • After setting the correct time (for example 18:00), the label is automatic updated, but shows '16:00'. This seems like a UTC to CEST problem (my local timezone is CEST)

Now popping in my head, I also noticed the following occording a Multiline text (DataType.MultiLineText) control and waterline (Display(Prompt)), also in iOS. After decorating the bindable property in the VM, the multiline text control is rendered correctly, but the watermark is not shown. The label is, but the watermark not. This behavior does only apply for iOS


Unfortunately I am unable to present some screenshots. If you need some more information, please let met know.
Kind regards,

1 Reply

VR Vigneshkumar Ramasamy Syncfusion Team August 5, 2018 04:36 PM UTC

Hi Patrik,  
  
Regarding TimePicker query:   
   
We have checked query with time picker editor value only considered as UTC value while selecting from UITimePicker in Xamarin.Forms.iOS platform, since the default value of UITimePicker Date property returns with UTC value.  
  
We are able to reproduce the mentioned issue and we have logged on issue report to consider the time picker value considered with local time zone. we wil include this issue fix in our upcoming Volume 2 SP2 release. We appreciate your patience until then.  
  
Regarding PlaceHolder text in Multiline text   
                   
We have analyzed your query for place holder text in Multiline text editor. In UITextView, there is no direct API for PlaceHolderText in the Framework for iOS platform. So PlaceHolderText will not work in inbuilt (MultiLineText) dataform editor in DataForm. PlaceHolderText API is available only inUITextField.  
  
However, through registering custom view in custom editor your requirement can be achieved in sample level. You can refer our online user guide documentation for creating new custom editor in DataForm.  
  
  
We have created a sample for multiline text editor, created a custom renderer inherited from ViewRenderer.   
  
Note: In ViewRenderer, Custom UITextView with PlaceHolderText customization is returned.  
  
Code snippet :  
  
  
[assembly: ExportRenderer(typeof(CustomEntryEditor), typeof(CustomEntryRenderer))]
namespace GettingStarted.iOS
{
    class CustomEntryRenderer : ViewRenderer
    {
        private CustomEntryEditor FormsEntry { get; set; }

        protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.View> e)
        {
            base.OnElementChanged(e);
            if (e.NewElement != null)
            {
                FormsEntry = (e.NewElement as CustomEntryEditor);
                CustomNativeView textView = new CustomNativeView() { Text = FormsEntry.PlaceHolderText, Placeholder = FormsEntry.PlaceHolderText, TextColor = UIColor.Gray};
                this.SetNativeControl(textView);
            }
        }
    }

    public class CustomNativeView : UITextView
    {
   
        public string Placeholder { get; set; }
        public CustomNativeView()
        {
            ShouldBeginEditing = t =>
            {
                if (Text == Placeholder)
                {
                    Text = string.Empty;
                    TextColor = UIColor.Black; 
                }

                return true;
            };

            ShouldEndEditing = t =>
            {
                if (string.IsNullOrEmpty(Text))
                {
                    TextColor = UIColor.Gray; 
                    Text = Placeholder;
                }
                return true;
            };
        }

    }
}  
  
  
  
  
  
If the provided solution doesn’t meet your requirement, could you please revert us back with more details regarding your requirement or modify the provided sample. So that it will be helpful for us to provide you possible solution.  
                  
Regards,  
Vigneshkumar R 


Loader.
Up arrow icon