• 0

[c# / WPF] Stopping Effect Animation


Question

Hello gang,

I have a menu that has a "glow" effect that works fine, but I cannot find out how to stop it. I have tried setting: effTitleFade = null; but the effect keeps going. What am I missing?

I found the example here:http://social.msdn.microsoft.com/Forums/en/wpf/thread/5533e0ef-aad0-4a4a-8f16-c681ec94d346


DropShadowEffect effTitleFade = new DropShadowEffect();
effTitleFade.Color = Color.FromArgb(0, 0, 255, 255);
effTitleFade.Direction = 0;
effTitleFade.BlurRadius = 0;
effTitleFade.ShadowDepth = 0;
this.txtTitle.Effect = effTitleFade;
DoubleAnimation daBlur = new DoubleAnimation(0, 25, new Duration(TimeSpan.FromSeconds(4)));
daBlur.AutoReverse = true;
daBlur.RepeatBehavior = RepeatBehavior.Forever;
effTitleFade.BeginAnimation(DropShadowEffect.BlurRadiusProperty, daBlur);
[/CODE]

Link to comment
https://www.neowin.net/forum/topic/1096249-c-wpf-stopping-effect-animation/
Share on other sites

7 answers to this question

Recommended Posts

  • 0

I'd venture the offending line is this:


daBlur.RepeatBehavior = RepeatBehavior.Forever;
[/CODE]

Thanks... but no. I want the daBlur to repeat forever until the user selects an option (moving from one menu to another) At that time I need to shut off the glow from this MenuItem and turn it on with another.

  • 0

If you want to remove the effect you just assigned, simply assign Effect to null.

To answer your original question, setting effTitleFade to null changes the effTitleFade variable to point to null instead of the object you created. But your TextBlock's Effect property still holds a reference to that object.

If I give you a piece of paper with my address on it, you'll be able to come to my house and paint it green. But if you erase what was written on the piece of paper, my house still exists. To make it disappear, I'd need to lose my own piece of paper that says where I live, at which point the city notices that nobody uses that house anymore and destroys it to replace it with something else the next time space is needed. Here, the pieces of paper are the references to my house and the city is the garbage collector.

  • 0

If you want to remove the effect you just assigned, simply assign Effect to null.

To answer your original question, setting effTitleFade to null changes the effTitleFade variable to point to null instead of the object you created. But your TextBlock's Effect property still holds a reference to that object.

If I give you a piece of paper with my address on it, you'll be able to come to my house and paint it green. But if you erase what was written on the piece of paper, my house still exists. To make it disappear, I'd need to lose my own piece of paper that says where I live, at which point the city notices that nobody uses that house anymore and destroys it to replace it with something else the next time space is needed. Here, the pieces of paper are the references to my house and the city is the garbage collector.

Thank you very much for the clarification.

This topic is now closed to further replies.
  • Posts

    • As someone who isn't in the EU what is all this gatekeeper stuff about anyways?
    • The data center gold rush has tossed all forms of sensibility and reasoning right out of the window. The craziest part being that AI infrastructure isn't driven by consumer demand. It's being driven by manufacturers to force AI onto the market, consumers be damned.
    • Apple has not said whether the new prices are temporary ..... LOL.... These are the new prices peeps, because they will still sell them. Everybody will get used to the price hike = more Profit!
    • EU says AWS and Microsoft Azure should be treated as DMA gatekeepers by Pradeep Viswanathan Under the European Commission's Digital Markets Act (DMA), a company is presumed to be a gatekeeper if it meets certain quantitative thresholds. However, the Commission can still investigate and designate a company even if it does not meet the numeric thresholds, provided the service has a major market impact. The European Commission launched its investigations into AWS and Azure on November 18, 2025, to address unfair or anti-competitive practices in the cloud sector. Today, the European Commission has informed Amazon and Microsoft of its preliminary view that their cloud computing services, AWS and Azure, should be designated as gatekeepers under the DMA. The EC highlighted that Amazon Web Services (AWS) and Microsoft Azure are the largest and second-largest cloud computing services in the European Union. Both of these platforms act as important gateways between businesses and their customers in the EU. The EC further mentioned that AWS and Azure have reached significant turnover, built large and entrenched user bases, and benefit from high switching costs and customer lock-in. Furthermore, their operational capacity and investments appear to have outpaced those of competitors. Teresa Ribera, Executive Vice-President for Clean, Just and Competitive Transition, said the following: It is important to note that the findings are preliminary and do not decide the final outcome. Amazon and Microsoft can now review the findings and respond to the Commission. However, if the Commission confirms its preliminary findings, it will formally designate Amazon and Microsoft as gatekeepers for AWS and Azure. Once designated, Microsoft and Amazon will have six months to bring their cloud services into full compliance with the DMA’s rules and regulations.
    • will EU users be getting the extra 1yr update for free again?
  • Recent Achievements

    • First Post
      kinowa earned a badge
      First Post
    • Rookie
      krychek57 went up a rank
      Rookie
    • Grand Master
      Jaybonaut went up a rank
      Grand Master
    • One Year In
      Philsl earned a badge
      One Year In
    • Dedicated
      Scoobystu earned a badge
      Dedicated
  • Popular Contributors

    1. 1
      +primortal
      436
    2. 2
      +Edouard
      168
    3. 3
      PsYcHoKiLLa
      133
    4. 4
      Xenon
      76
    5. 5
      Michael Scrip
      75
  • Tell a friend

    Love Neowin? Tell a friend!