private void Button_Click(object sender, RoutedEventArgs e) { MessageBox.Show(e.ToString()); }
private void TextBox_TextChanged(object sender, RoutedEventArgs e) { string text = ((TextBox)sender).Text; if (text == "hello") { e.Handled = true; } }In this example, the TextChanged event of a textbox is handled and the event arguments (e) are used to access the sender of the event (which is the textbox), and then the text of the textbox. If the text is "hello" then the event is marked as handled using the Handled property of the event arguments. The package library for this method is the WindowsBase.dll.