TimePicker Control For Windows 10

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"></TextBlock>  
  2. <StackPanel Margin="20,30,0,0">  
  3.     <TimePicker Name="myTime" Header="Select a time" ClockIdentifier="12HourClock" TimeChanged="myTime_TimeChanged" Margin="15,0,0,0"></TimePicker>  
  4.     <TextBlock x:Name="selectedTime" Margin="15,15,0,0" Foreground="Green" /> </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 to 24 hour the AM/PM selection part will not be available.

 

Step 2: Copy and paste the following code to the myTime_Time Changes event in in the cs page and run your application. 
  1. selectedTime.Text = "Selected time is " + e.NewTime.ToString();   

Up Next
    Ebook Download
    View all
    Learn
    View all