This is a migrated thread and some comments may be shown as answers.

TKDataFormDatePickerEditor Null Date

1 Answer 79 Views
DataForm - Xamarin.iOS
This is a migrated thread and some comments may be shown as answers.
jon
Top achievements
Rank 1
jon asked on 01 Feb 2016, 04:55 AM
I'm trying to make a TKDataFormDatePickerEditor to load with an empty date field but the TKDataFormDatePickerEditor always shows today date. Here's what I'm doing in the UpdateEditor method after setting the value candidate to null.
if (property.Name == "StartDate") {
  if (this.ownerVC.dataSource ["StartDate"].ValueCandidate == null) {
    ((TKDataFormDatePickerEditor)editor).EditorValueLabel.Text = string.Empty;
  }
}

1 Answer, 1 is accepted

Sort by
0
Adrian
Telerik team
answered on 03 Feb 2016, 03:30 PM
Hello, Jon,

Thank you for contacting us.

To show an empty string as text to the editor value label when the value candidate is null you should use the hintText property of TKEntityProperty. Consider the code snippet:
public override void ViewDidLoad ()
{
    base.ViewDidLoad ();
    //..
    this.dataSource ["DateOfBirth"].HintText = string.Empty;
    //..
}

Another option is to implement SetupEditor method and use the Placeholder property of TKDataFormDatePickerEditor:
public override void SetupEditor (TKDataForm dataForm, TKDataFormEditor editor, TKEntityProperty property)
{
    if (property.Name == "DateOfBirth") {
        ((TKDataFormDatePickerEditor)editor).Placeholder = string.Empty;
    }
}

I hope this helps. If you have further questions, feel free to contact us again.

Regards,
Adrian
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
DataForm - Xamarin.iOS
Asked by
jon
Top achievements
Rank 1
Answers by
Adrian
Telerik team
Share this question
or