I am making a calculator using WPF Application in MS Visual Studio 2010. I have made different buttons that are in a standard calculator and I have added button_Click methods on them. Now I also want to perform the same tasks as the button_Click method is performing by stroking the specific key.
For Example
I have “addButton_Click” method and it performs this:
private void addButton_Click(object sender, RoutedEventArgs e)
{
_op = 1;
temp = displayPannel.Text;
check = true;
}
Now What If I wanted the “+” key to do the same thing in the calculator instead of using the mouse to click on “+” button. Also I want to use the numeric keys as well along with the mouse clicking. How can I do it?
MainWindow.xaml.cs
MainWindow.xaml