Up vote 0 down vote favorite share g+ share fb share tw.
I'm using a WPF Expander to display a number of analog process variables. I want to make the expander's border 'glow' (or flash) when one of these variables enters a 'warning' or 'alarm' state. To achieve this, I'm using some data triggers bound to a couple of boolean properties in my view model ('AnalogWarningActive' and 'AnalogAlarmActive').
The data triggers kick off a storyboard that animates the expander border opacity. The data triggers work as I'd expect: the proper border colour appears and the opacity animation begins. However, there are 2 problems: The opacity of the entire expander (and all contained controls) is changing and not just the opacity of its border.
When the 'AnalogWarningActive' and 'AnalogAlarmActive' tags return to False, the border disappears but the opactiy animation continues indefinitely (ie. The entire expander continues to fade in and out). Here is the xaml I'm using: c# wpf xaml storyboard link|improve this question edited Nov 9 '09 at 16:24 asked Nov 9 '09 at 15:44user158485120111 67% accept rate.
Question #1 The Opacity setting on a Visual such as Border affects that Visual and all its descendants. That is why setting Border. Opacity makes everything disappear.
You have two choices: 1. Animate the border Stroke property, or 2. Change the content to not be a descendant of Border.
Animating the Stroke property is trivial to code, but has the disadvantage that not all brushes are easily animatable to transparent and back. For example, this is difficult with gradient brushes. Also, if your borders were a variety of colors and you didn't want to go to 100% transparent there is no good way to animate the Stroke without changing the color.
Changing the content to not be a descendant of Border is very simple, and is what I would be inclined to do in most cases. Simply replace: with this: Now the visible border's opacity can be animated, while the transparent one controls the layout and clipping of the child. If you don't have any CornerRadius or other funny business, you can just set a margin on the content and forego the transparent border: Question #2 At first glance I don't see any problem with your XAML that would cause the animation to keep running after the triggering value goes back to false, but I didn't look very closely.
From what I noticed I would think it would stop the animation at the current value, not leave it running. You might try replacing StopStoryboard with RemoveStoryboard. RemoveStoryboard should reset the animated properties back to their original values.
This works perfectly. Implementing your suggestion for question #1 seemed to fix #2 as well. Thanks!
– user158485 Nov 9 '09 at 20:07.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.