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

RadGridView RadDateTimePicker Time selector default date

0 Answers 134 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Rahul
Top achievements
Rank 1
Rahul asked on 25 Jun 2013, 03:17 PM
I am using a RadGridView, which has a column whose data template is a RadDateTimePicker. The value for this column is data bound (MVVM) to a nullable date time property. So when I create a new row, the initial value is null and then the user will set the value for the date time using the picker (See xaml code below).

Now, I am setting the SelectableStartDate property for the picker to tomorrow since i do no want the user to be able to select a date as today or in the past. Assuming I just added a new row with a null/empty date time value and just clicked on the cell to open the date time picker, if I select the time first and not the date, it is firing the binding with the date as today's date with the selected time, even though the Selectable date is set to start from tomorrow. I tried using some properties on the picker itself to try and change that but could not make it work. 

Any suggestions on this? 

<telerik:GridViewDataColumn Header="Start Date"
                                Width="135"
                                Name="StartDateColumn"
                                EditTriggers="CurrentCellClick"
                                DataFormatString="{}{0:M/d/yyyy hh:mm tt}"
                                CellStyleSelector="{StaticResource startDateCellStyleSelector}"
                                DataMemberBinding="{Binding StartDate}">
    <telerik:GridViewDataColumn.CellEditTemplate>
        <DataTemplate>
            <telerik:RadDateTimePicker SelectableDateStart="{Binding SelectableStartDate}" SelectedValue="{Binding StartDate, Mode=TwoWay}"/>
        </DataTemplate>
    </telerik:GridViewDataColumn.CellEditTemplate>
     
    <telerik:GridViewDataColumn.HeaderCellStyle>
        <Style TargetType="telerik:GridViewHeaderCell">
            <Setter Property="Background" Value="#437F7B"/>
            <Setter Property="Foreground" Value="White"/>
        </Style>
    </telerik:GridViewDataColumn.HeaderCellStyle>
 
</telerik:GridViewDataColumn>

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Rahul
Top achievements
Rank 1
Share this question
or