Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C# and XAML in Visual Studio: Build a simple WPF app for picking a date and time. An example interface is shown above that

Using C# and XAML in Visual Studio:

Build a simple WPF app for picking a date and time. An example interface is shown above that includes:

a calendar for date selection. (10pts)

a textbox for time display (10pts)

Up and Down buttons to adjust time. Hours, minutes and AM/PM should be incremented or decremented based on the cursor position. For example, you would want to be able to do continuous adjust minutes when the cursor is placed in the minutes field (20pts)

a Select botton that when clicked, should print a message (either in the MainWindow with a textbox, or a Message box) in the following format: Your appointment is on Wednesday, March 2, 2018 at 9:15AM. Its 18 days from today. (10pts)

1. Use DateTime struct from .NET Class Library to handle date and time https://msdn.microsoft.com/en-us/library/system.datetime.aspx

2. Calendar is a built-in UI element that you can drag from the Toolbox and its ready to use. Use Calendar_SelectedDatesChanged event for date selection. For more information on Calendar class: https://msdn.microsoft.com/en-us/library/system.windows.controls.calendar(v=vs.110).aspx

3. To parse time from textbox, DateTime.Parse Method (String) https://msdn.microsoft.com/en-us/library/1k1skd40(v=vs.110).aspx

4. To adjust time with Up & Down button, DateTime.AddHours Method (Double) https://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=ENUS&k=k(System.DateTime.AddHours);k(TargetFrameworkMoniker- .NETFramework,Version%3Dv4.5.2);k(DevLang-csharp)&rd=true Similarly for AddMinutes. AM/PM is simply a 12-hour changes.

5. Adjustment of hours, minutes, AM/PM should be based on cursor position. It can be tricky to do the continuously adjustment on hrs/min/am/pm. The following property can be useful. TextBox.SelectionStart Property: Gets or sets a character index for the beginning of the current selection. https://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=ENUS&k=k(System.Windows.Controls.TextBox.SelectionStart);k(TargetFrameworkMoniker- .NETFramework,Version%3Dv4.5.2);k(DevLang-csharp)&rd=true TextBox.CaretIndex Property: Gets or sets the insertion position index of the caret. https://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=ENUS&k=k(System.Windows.Controls.TextBox.CaretIndex);k(TargetFrameworkMoniker- .NETFramework,Version%3Dv4.5.2);k(DevLang-csharp)&rd=true

image text in transcribed

MainWindow February 2017 Su Mo Tu We Th Fr Sa 9 30 31 1 23 5 678 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 2812 3 5 6789 10 11 9:53 AM Up Down Select MainWindow February 2017 Su Mo Tu We Th Fr Sa 9 30 31 1 23 5 678 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 2812 3 5 6789 10 11 9:53 AM Up Down Select

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Rules In Database Systems Third International Workshop Rids 97 Sk Vde Sweden June 26 28 1997 Proceedings Lncs 1312

Authors: Andreas Geppert ,Mikael Berndtsson

1997th Edition

3540635165, 978-3540635161

Students also viewed these Databases questions

Question

design a simple performance appraisal system

Answered: 1 week ago