Step 1: Create an empty WPF using Visual Studio, enter the name for the application and click on OK

Step 2: Create a button using the following code or drag and drop a button from the ToolBox of Visual Studio 2013.

Code:
- <Button Content="Button" HorizontalAlignment="Left" Margin="133,120,0,0" VerticalAlignment="Top" Width="75"/>

Enter the following code to make you click event activated with message box:
- MessageBox.Show("hI How are you");
- using System;
- usingSystem.Collections.Generic;
- usingSystem.Linq;
- usingSystem.Text;
- usingSystem.Threading.Tasks;
- usingSystem.Windows;
- usingSystem.Windows.Controls;
- usingSystem.Windows.Data;
- usingSystem.Windows.Documents;
- usingSystem.Windows.Input;
- usingSystem.Windows.Media;
- usingSystem.Windows.Media.Imaging;
- usingSystem.Windows.Navigation;
- usingSystem.Windows.Shapes;
- namespacemessageapp
- {
- ///<summary>
- /// Interaction logic for MainWindow.xaml
- ///</summary>
- publicpartialclassMainWindow: Window
- {
- publicMainWindow()
- {
- InitializeComponent();
- }
- privatevoidButton_Click(object sender, RoutedEventArgs e)
- {
- MessageBox.Show("hI How are you");
- }
- }
- }


Pradeep SahooPosted May 22, 2016, 12:14 AM
Nice ....
Prasanna MuraliPosted May 20, 2016, 9:53 AM
Nice one....