Requirements: Visual Studio 2015 or higher version with Windows SDK.
Step 1: Open Visual Studio 2015 and afterwards, go to File and go to New. Now, go to project.
File→New→Project.

Step 2: We can choose Visual C# and select Windows. Afterwards, select the universal and next select the Blank App(Universal Windows).
Visual C#→Windows→universal→Blank App(Universal Windows).

Step 3: Choose the target and minimum platform versions, which your Universal Windows Application will support.
Step 4: Open Mainpage.XAML, add the codes given below:
The page is given below:
Step 5: Open Mainpage.cs file, add the code, given below:
- namespace calculator12
- {
- /// <summary>
- /// An empty page that can be used on its own or navigated to within a Frame.
- /// </summary>
- public sealed partial class MainPage : Page
- {
- string input = string.Empty;
- string x = string.Empty;
- string y = string.Empty;
- char operation;
- double result = 0.0;
- public MainPage()
- {
- this.InitializeComponent();
- }
- private void button1_Click(object sender, RoutedEventArgs e)
- {
- this.textBox.Text = " ";
- input += "1";
- this.textBox.Text += input;
- }
- private void button_Click(object sender, RoutedEventArgs e)
- {
- this.textBox.Text = " ";
- input += "2";
- this.textBox.Text += input;
- }
- private void button2_Click(object sender, RoutedEventArgs e)
- {
- this.textBox.Text = " ";
- input += "3";
- this.textBox.Text += input;
- }
- private void button3_Click(object sender, RoutedEventArgs e)
- {
- this.textBox.Text = " ";
- input += "4";
- this.textBox.Text += input;
- }
- private void button4_Click(object sender, RoutedEventArgs e)
- {
- this.textBox.Text = " ";
- input += "5";
- this.textBox.Text += input;
- }
- private void button5_Click(object sender, RoutedEventArgs e)
- {
- this.textBox.Text = " ";
- input += "6";
- this.textBox.Text += input;
- }
- private void button6_Click(object sender, RoutedEventArgs e)
- {
- this.textBox.Text = " ";
- input += "7";
- this.textBox.Text += input;
- }
- private void button7_Click(object sender, RoutedEventArgs e)
- {
- this.textBox.Text = " ";
- input += "8";
- this.textBox.Text += input;
- }
- private void button8_Click(object sender, RoutedEventArgs e)
- {
- this.textBox.Text = " ";
- input += "9";
- this.textBox.Text += input;
- }
- private void button9_Click(object sender, RoutedEventArgs e)
- {
- this.textBox.Text = " ";
- input += "0";
- this.textBox.Text += input;
- }
- private void button10_Click(object sender, RoutedEventArgs e)
- {
- x = input;
- operation = '+';
- input = string.Empty;
- }
- private void button11_Click(object sender, RoutedEventArgs e)
- {
- x = input;
- operation = '-';
- input = string.Empty;
- }
- private void button12_Click(object sender, RoutedEventArgs e)
- {
- x = input;
- operation = '*';
- input = string.Empty;
- }
- private void button13_Click(object sender, RoutedEventArgs e)
- {
- x = input;
- operation = '/';
- input = string.Empty;
- }
- private void button14_Click(object sender, RoutedEventArgs e)
- {
- this.textBox.Text = " ";
- input += ".";
- this.textBox.Text += input;
- }
- private void button16_Click(object sender, RoutedEventArgs e)
- {
- y = input;
- double num1, num2;
- double.TryParse(x, out num1);
- double.TryParse(y, out num2);
- if (operation == '+')
- {
- result = num1 + num2;
- textBox.Text = result.ToString();
- }
- else if (operation == '-')
- {
- result = num1 - num2;
- textBox.Text = result.ToString();
- }
- else if (operation == '*')
- {
- result = num1 * num2;
- textBox.Text = result.ToString();
- }
- else if (operation == '/')
- {
- if (num2 != 0)
- {
- result = num1 / num2;
- textBox.Text = result.ToString();
- }
- else
- {
- textBox.Text = "DIV/Zero!";
- }
- }
- }
- private void button15_Click(object sender, RoutedEventArgs e)
- {
- textBox.Text = "0";
- }
- }
- }







Step 6: You can run the project.

Step 7: You can see the output, given below:



Pria IbPosted Oct 2, 2018, 12:26 PM
Would you mind to put the XAML code like the Mainpage.cs? I can't see the XAML code in the picture :,c
SubashPosted Sep 7, 2016, 7:53 AM
Good job
Hanif HefazPosted Aug 20, 2016, 2:37 PM
Hmmm Great start.
Vijayaragavan SPosted Aug 12, 2016, 12:38 AM
Nice start...