TimePicker- How I bind the selected time to view model

1 Answer 64 Views
TimePicker
Daniel
Top achievements
Rank 1
Silver
Bronze
Daniel asked on 17 Mar 2022, 10:32 AM

Hi,

How I bind the selected time to view model ?

Thanks,

Daniel
Top achievements
Rank 1
Silver
Bronze
commented on 17 Mar 2022, 11:07 AM

I used this code:


      <telerikInput:RadTimePicker x:Name="startTimePickerOneTimeStartTime" Placeholder="Start Time" Margin="5" Time="{Binding SelectedOneTimeStartTime, Mode=TwoWay}" WidthRequest="130"/>
         
How I set value  SelectedOneTimeStartTime in runtime ?
Daniel
Top achievements
Rank 1
Silver
Bronze
commented on 17 Mar 2022, 11:10 AM

 

Time has no setter .

1 Answer, 1 is accepted

Sort by
0
Didi
Telerik team
answered on 18 Mar 2022, 08:28 AM

Hi Daniel,

The Time property of the TimePicker is of type TimeSpan?, it is not of type DateTime. More details about time span can be found here: https://docs.microsoft.com/en-us/dotnet/api/system.timespan?view=net-6.0 

Example with binding the TimePicker.Time property can be found in this forum thread: https://www.telerik.com/forums/telerikinput-radtimepicker-bind-its-selection-to-view-model#5461614 

Regards,
Didi
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
TimePicker
Asked by
Daniel
Top achievements
Rank 1
Silver
Bronze
Answers by
Didi
Telerik team
Share this question
or