What is the difference between time vs selected time in TimePicker?

Viewed 111

The TimePicker control of uwp has two properties Time and SelectedTime. I read the documentation of Microsoft, but could not find the difference between the two. When I print both values, they are same. Could anybody explain the difference between the two?

Debug.WriteLine(ToastTimeTimePicker.Time);
Debug.WriteLine(ToastTimeTimePicker.SelectedTime);
1 Answers

What is the difference between time vs selected time in TimePicker?

In general, in terms of usage, there is no difference between Time and SelectedTime. The Time property represents the time currently set in the time picker and the SelectedTime property represents the time currently selected in the time picker. When you set a value to the Time property, the time picker will selecte and display that time, then the SelectedTime property will also update, so the values of Time and SelectedTime are the same.

However, the default value between Time and SelectedTime is different. When you do not set the initial time for TimePicker manually or using code, the default value of SelectedTime is null and the default value of Time is the time that the TimePicker object is instantiated when the app runs or loads that specific object, as a one-time operation.

Related