public MainWindow() { InitializeComponent(); this.Loaded += new RoutedEventHandler(MainWindow_Loaded); this.button1.Click += new RoutedEventHandler(button1_Click); //AddHandler this.button1.AddHandler(Button.MouseRightButtonDownEvent, new RoutedEventHandler(Show), true); } private void button1_Click(object sender, RoutedEventArgs e) { } private void Show(object sender,RoutedEventArgs e) { DoubleAnimation animation = new DoubleAnimation(); animation.From = 0; animation.To = 1; animation.Duration = TimeSpan.FromSeconds(3); this.textBlock1.BeginAnimation(TextBlock.OpacityProperty, animation); } private void MainWindow_Loaded(object sender, RoutedEventArgs e) { }