using System; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; public class MainClass : Window { [STAThread] public static void Main() { Application app = new Application(); app.Run(new MainClass()); } public MainClass() { Button btn = new Button(); btn.Content = "_Click me"; btn.Click += ButtonOnClick; Content = btn; } void ButtonOnClick(object sender, RoutedEventArgs args) { MessageBox.Show("asdf",Title); } }