Sunday, March 11, 2012

How to use DatePicker Control in Wp7

Hello,

in this blog I'm going to talk about DataPicker Control in windows phone 7

I used it in my application How old

The DatePicker looks:


first, you should download The Windows Phone Toolkit from here: http://goo.gl/L1H0j
Straight from Microsoft, both the Silverlight Toolkit and Silverlight for Windows Phone Toolkit provide the developer community with new components, functionality, and an efficient way to help shape product development. Toolkit releases include open source code, samples & docs. 
 The toolkit provides many useful components like AutoCompleteBox, DatePicker, DateTimeConverters, GestureService, PerformanceProgressBar, TimePicker, WrapPanel, and more....




After installing the toolkit, press Ctrl+Shift+N to create a new project



  then add a reference to the silverlight toolkit dll, right-click on the References item for your project and choose Add Reference, then add Microsoft.Phone.Controls.Toolkit and press ok






in the xaml code, you should add toolkit prefix declaration
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"

then the code is
 <toolkit:DatePicker x:Name="datePicker" Value="2/3/2010"/>
then you should add the applicationBar Icons

-create a new folder and name it "Toolkit.Content" 
-copy the icons from C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.1\Toolkit\Oct11\Bin\Icons
They must be named "ApplicationBar.Check.png" and "ApplicationBar.Cancel.png", The Build Action must be "Content".




you can customize the Date format
<toolkit:DatePicker x:Name="datePicker" Value="2/3/2010"  ValueStringFormat="{}{0:D}"/>

The standard for date formats: http://msdn.microsoft.com/en-us/library/az4se3k1%28v=VS.95%29.aspx


you can also add a header
 Header="DatePicker"
There are many events you can use
for example ValueChanged

        private void datePicker_ValueChanged(object sender, DateTimeValueChangedEventArgs e)
        {
                textBox1.Text = datePicker.ValueString;
        }


Friday, March 2, 2012

Windows Phone 7



I have attended a session 2 months ago called “Wp7Spark” to get started with Windows Phone 7, then I learned a lot of good things by myself.

The System looks easier for developers and users as well, but needs a  very good device.

The System looks like :







Application Life Cycle:








to get started:


download The VISUAL STUDIO 2010 EXPRESS FOR WINDOWS PHONE


or download the SDK: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=27570


Tutorials for getting started: http://create.msdn.com/en-US/education/quickstarts




I will blog (iSA) about solutions for problems I faced while developing.