SIGN UP MEMBER LOGIN:    
ARTICLE

Windows Phone 7 DatePicker Control

Posted by Raj Kumar Articles | Windows Phone in C# March 28, 2011
This article demonstrates the use of a DatePicker control in Windows Phone 7. By default the DatePicker shows today's date; when the control is clicked a dialog should open for selecting day, month and year; then after clicking done, the selected date should load into the control.
Reader Level:


This article demonstrates the use of a DatePicker control in Windows Phone 7. By default the DatePicker shows today's date; when the control is clicked a dialog should open for selecting day, month and year; then after clicking done, the selected date should load into the control.

Steps to do:

  • First of make a new Silverlight Windows Phone project and save given location
  • Now (if not yet done) download the Windows Phone 7 toolkit from the Codeplex website and save in your hard drive.
  • Add a reference to Microsoft.Phone.Controls.Toolkit.dll in your application like image 1.

Now add a namespace on .xaml page or add this Microsoft.Phone.Controls.Toolkit.dll in toolbox when drag and drop control on page this namespace should add automatically.

xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"

<toolkit:DatePicker HorizontalAlignment="Left" Margin="149,219,0,0"
Name
="txtPostedOn" VerticalAlignment="Top" Width="325"
Height
="55" FontFamily="Verdana"
FontSize
="13.333" Foreground="#FFDA4D4D" />

img1.jpg

Image 1.

img2.jpg

Image 2.

After adding control on page it looks like this. When click on control this window should open.

IMG3.jpg

Image 3.

Here you can select Month, Day and year by clicking on these rectangles like this. You can scroll top and bottom.

Note - These cross icon images shows left one is for done and right icon for cancel.

IMG4.jpg

Image 4.

When you are done with this click on the Done icon.

IMG5.jpg

Image 5.

Login to add your contents and source code to this article
share this article :
post comment
 

Nice!

Posted by Mahesh Chand Mar 28, 2011
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
Become a Sponsor