User Tools

Site Tools


notes:uwp:datetimecontrols

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
notes:uwp:datetimecontrols [2017/02/23]
admin [TimePicker]
notes:uwp:datetimecontrols [2017/02/23] (current)
admin [TimePicker]
Line 153: Line 153:
 </​WRAP>​ </​WRAP>​
  
-The pop-up portion of the //​TimePicker//​ control uses //​TimePickerFlyout//​.+  * The //​TimePicker//​ can use a 12-hour or 24-hour clock. 
 +  * The pop-up portion of the //​TimePicker//​ control uses //​TimePickerFlyout//​.
  
 Example: Example:
Line 178: Line 179:
             Time="​{Binding Path=WorkedHours,​ Mode=TwoWay"​ />             Time="​{Binding Path=WorkedHours,​ Mode=TwoWay"​ />
 </​code>​ </​code>​
 +
 +
 +Example: Set the //​TimePicker//'​s time programmatically:​
 +
 +<code csharp>
 +// Set the time to 8 A.M.
 +TimePicker1.Time = new TimeSpan(8, 0, 0);
 +</​code>​
 +
 +
 +Example: Handle the //​TimeChanged//​ event:
 +
 +<code xml>
 +<​TimePicker x:​Name="​TimePicker1" ​
 +            Header="​Select a time:" ​
 +            Time="​12:​00:​00" ​
 +            TimeChanged="​TimePicker1_TimeChanged"​ />
 +</​code>​
 +
 +<code csharp>
 +private void TimePicker1_TimeChanged(object sender, TimePickerValueChangedEventArgs args)
 +{
 +    Debug.WriteLine(args.NewTime.ToString());​
 +}
 +</​code>​
 +
  
notes/uwp/datetimecontrols.txt · Last modified: 2017/02/23 by admin