Good morning,
I have a RadGridView with GridViewDataColumns which have ShowDistinctFilters="False" and contain DateTime values from an Odata service collection.
I want to have the RadDateTimePicker control in the filter for the GridViewDataColumn to let me filter on the "Time" portion of the DateTime object.
Currently my mark-up for a column is:
<
telerik:GridViewDataColumn
ShowDistinctFilters
=
"False"
DataMemberBinding
=
"{Binding ADD_DATE}"
Header
=
"Date Added"
/>
This gives me the result of telerik_data_filter_date_time_example.png when I try to filter.
What I want is to also have the time portion (hours, minutes, and seconds) selectable in those filters. I can accomplish this in a RadDataFilter control if I set EditorCreated="radDataFilter_EditorCreated" and then have the following code (mainly from line 9 of the below snippet):
01.
private
void
radDataFilter_EditorCreated(
object
sender, EditorCreatedEventArgs e)
02.
{
03.
if
(e.ItemPropertyDefinition.PropertyType.Equals(
typeof
(DateTime)))
04.
{
05.
RadDateTimePicker dateTimePickerEditor = e.Editor
as
RadDateTimePicker;
06.
dateTimePickerEditor.InputMode = DateTimePicker;
07.
dateTimePickerEditor.Culture =
new
CultureInfo(
"en-US"
);
08.
dateTimePickerEditor.Culture.DateTimeFormat.ShortDatePattern =
"MM/dd/yyyy"
;
09.
dateTimePickerEditor.Culture.DateTimeFormat.ShortTimePattern =
"hh:mm:ss tt"
;
10.
}
11.
12.
/* snipped remaining part of the method */
13.
}
Is there any way I can create the same effect within the filters on the RadGridView for that GridViewDataColumn that contains DateTime values? I'd prefer a XAML solution for this if possible, but if necessary, I can use a code behind solution as well.
Thanks!