Windows Phone 7 – Simple calculator example

By -

Hello all,

Yes this time i am going to write Windows Phone 7 again, yes its again as i had written below articles for the WP7 category on this blog:

1. How to start with Windows Phone 7 Development?
2. Windows Phone 7 – Hello World Application
3. Windows Phone 7 – Types of Controls

And as being an android developer, i was trying to find out which platform will be most exciting to learn next, i have found myself to start with WP7 instead of BlackBerry because WP7 provides more flexibility than BlackBerry app development. FYI, i have also tried to develop basic example in BlackBerry but it requires a lot to implement this simple Calculator example where as here i just created this example in 10-15 minutes.

=> I hope you are done with Windows Phone 7 installation (which is mentioned in 1st link above) before starting with this example.

Here is a solution for Simple Calculator example:
Output:

WP7 Simple Calculator

WP7 Simple Calculator

WP7 Simple Calculator

WP7 Simple Calculator

Main.xaml



    
    
        
            
            
        

        
        
            
            
        

        
        
            

Code for button click event:

  private void button1_Click(object sender, RoutedEventArgs e)
        {
            txtResult.Text = Convert.ToString(Convert.ToInt32(txtFirstNo.Text) + Convert.ToInt32(txtSecondNo.Text));
        }

What you say? Isn’t it cool? :)

Paresh Mayani

Paresh Mayani is a lead android developer from India. Currently, He is Sr. Software engineer at InfoStretch Solutions Pvt. Ltd. He has been developing android apps since very 1st version i.e. Android 1.5, he says he has seen days and nights of Android history. He is the Head/Organizer of Google Developers Group (GDG), Ahmedabad