TimePicker Control For Windows 10

Introduction 

 
TimePicker represents a control that allows a user to pick a time value.
 
Step 1
 
Open a blank app and add TimePicker and Textblock control either from the toolbox or by copying the following XAML Code into your grid.
  1. <TextBlock Text=" Time Picker " FontSize="20">  
  2. </TextBlock>    
  3. <StackPanel Margin="20,30,0,0">    
  4.     <TimePicker Name="myTime" Header="Select a time" ClockIdentifier="12HourClock" TimeChanged="myTime_TimeChanged" Margin="15,0,0,0">  
  5.     </TimePicker>    
  6.     <TextBlock x:Name="selectedTime" Margin="15,15,0,0" Foreground="Green" />   
  7. </StackPanel>    
The Header defines a small text above the TimePicker control.
 
The ClockIdentifier defines whether to show a 12 hour or 24-hour clock. By default, it is a 12-hour clock. By selecting it for 24 hours the AM/PM selection part will not be available.
 
 
 
Step 2
 
Copy and paste the following code to the myTime_Time Changes event on the cs page and run your application. 
  1. selectedTime.Text = "Selected time is " + e.NewTime.ToString();      
 

Summary

 
In this article, we learned about TimePicker Control For Windows 10. 


Similar Articles