I have followed this guide line for custom date format dd mmm yyyy (http://docs.telerik.com/devtools/wpf/controls/raddatetimepicker/features/formatting.html#changing-the-display-format)
But it affected date resolution when I manual enter date. Please refer attached screenshot.
3 Answers, 1 is accepted
0
Geri
Telerik team
answered on 15 Jul 2015, 12:31 PM
Hello Anita,
When you define a custom format of type "dd MMM yyyy", the month should be written with letters, instead of digits, otherwise it cannot be parsed.
However if you need to implement custom parsing logic, you can do it simply by hooking to the ParseDateTimeValue event of the control. Guidance on how to do this, you can find in this article:
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
Does it mean for custom display format, I have to override parsing logic?
Here I am trying to change display format but I still want to get whatever default parsing behavior available in control.
0
Rosi
Telerik team
answered on 17 Jul 2015, 03:04 PM
Hi Anita,
To achieve what you described in your first post you can just hook on the ParseDateTimeValue event and change the parsing logic only for a specific scenario as shown below. In this case all other cases will be handled by the default parsing logic of the control.
res = new DateTime(DateTime.Now.Year, DateTime.Now.Month, Convert.ToInt32(splitedInput[1])).Date;
break;
case 2: args.IsParsingSuccessful = true;
res = new DateTime(DateTime.Now.Year, Convert.ToInt32(splitedInput[0]), Convert.ToInt32(splitedInput[1])).Date;
break;
case 3: args.IsParsingSuccessful = true;
res = new DateTime(Convert.ToInt32(splitedInput[2]), Convert.ToInt32(splitedInput[0]), Convert.ToInt32(splitedInput[1])).Date;
break;
default: args.IsParsingSuccessful = true;
break;
}
}
args.Result = res;
}
In order to simplify the example, the input is hard-coded, but you can modify the logic according to your needs.
Hope this helps.
Regards,
Rosi
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