The RadControls For Metro suite of controls includes a very flexible DatePicker and TimePicker control that I’ll illustrate in this posting.
To get started, be sure to add a reference to the RadControls for Metro to your application.
As usual, we’ll begin with the data. This time the data is very simple. We start by creating a class representing a hotel or conference reservation,
Notice that the two properties are of type DateTime. I will use each to fill in and obtain information from a date picker and a time picker (rather than using four properties: ArriveDate, ArriveTime, DepartDate, DepartTime).
The initial values might be obtained from a database, or a web service or, in this case, they will be hardwired in the constructor,
Let’s turn to the XAML page. To begin, add two namespaces,
To make all this work, we’ll use two RadDatePicker instances and two RadTimePicker instances, all in a StackPanel.
Notice that the value for both the first RadDatePicker and the first RadTimePicker are identical; we are able to use the same date time object and the controls extract the data they need.
Jesse Liberty has three decades of experience writing and delivering software projects. He is the author of 2 dozen books and has been a Distinguished Software Engineer for AT&T and a VP for Information Services for Citibank and a Software Architect for PBS. You can read more on his personal blog or follow him on twitter
Subscribe to be the first to get our expert-written articles and tutorials for developers!