private void ShowText(string text) { var anima1 = new DoubleAnimation() { To = 0, Duration = TimeSpan.FromSeconds(0.1), }; anima1.Completed += delegate { TxtBlock.Text = text; var anima2 = new DoubleAnimation() { To = 1, Duration = TimeSpan.FromSeconds(0.1), }; TxtBlock.BeginAnimation(OpacityProperty, anima2); }; TxtBlock.BeginAnimation(OpacityProperty, anima1); }
public new void Show() { base.Show(); var anim = new DoubleAnimation { From = Opacity, To = 0, Duration = new Duration(TimeSpan.FromSeconds(3)) }; anim.Completed += Anim_Completed; BeginAnimation(OpacityProperty, anim); var animt = new DoubleAnimation { From = TxtBlock.Opacity, To = 0.2, Duration = new Duration(TimeSpan.FromSeconds(3)) }; TxtBlock.BeginAnimation(OpacityProperty, animt); }
private void BtnClear_Click(object sender, RoutedEventArgs e) { TxtBlock.Clear(); }