using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace WpfAppStyles1 { /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } void HandleThis(Object sender,RoutedEventArgs e) { e.Handled = true; MessageBox.Show(sender.ToString()); Button b = e.Source as Button; b.Background = new SolidColorBrush(Colors.Azure); //Altering Button's default properties and adding event B1.Background = Brushes.WhiteSmoke; B1.Content = "Code Prevails"; B1.Click += new RoutedEventHandler(More_Click); } private void textBox1_TextChanged(object sender, TextChangedEventArgs e) { B1.Background = Brushes.Yellow; B1.Content = "Changes"; } void More_Click(Object sender, RoutedEventArgs e) { textBox1.Text = "This is Scobee Doo be Dooo"; } } }