coloranimation

WPF - Making an animation's execution conditional on a property of the bound data item

一笑奈何 提交于 2019-11-29 06:46:35
问题 I have a data object -- a custom class called Notification -- that exposes a IsCritical property. The idea being that if a notification will expire, it has a period of validity and the user's attention should be drawn towards it. Imagine a scenario with this test data: _source = new[] { new Notification { Text = "Just thought you should know" }, new Notification { Text = "Quick, run!", IsCritical = true }, }; The second item should appear in the ItemsControl with a pulsing background. Here's

Wpf animate background color

℡╲_俬逩灬. 提交于 2019-11-27 07:57:25
I need help in taking right decision. I need to animate a background color of my user control when some event happens. When it is, I want to change the background just for 1 second and then turn it back. Which way should I go? Use color animation or timer or may by some other way. Solved. Thanks to all! This works good for me: ColorAnimation animation; animation = new ColorAnimation(); animation.From = Colors.Orange; animation.To = Colors.Gray; animation.Duration = new Duration(TimeSpan.FromSeconds(1)); this.elGrid.Background.BeginAnimation(SolidColorBrush.ColorProperty, animation); Klaus78 I

Wpf animate background color

China☆狼群 提交于 2019-11-26 11:06:37
问题 I need help in taking right decision. I need to animate a background color of my user control when some event happens. When it is, I want to change the background just for 1 second and then turn it back. Which way should I go? Use color animation or timer or may by some other way. Solved. Thanks to all! This works good for me: ColorAnimation animation; animation = new ColorAnimation(); animation.From = Colors.Orange; animation.To = Colors.Gray; animation.Duration = new Duration(TimeSpan