Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/302.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在C代码中设置dropshadoweffect的不透明度动画?_C#_Wpf_Animation - Fatal编程技术网

C# 如何在C代码中设置dropshadoweffect的不透明度动画?

C# 如何在C代码中设置dropshadoweffect的不透明度动画?,c#,wpf,animation,C#,Wpf,Animation,如何在代码中设置DropShadow效果不透明度的动画。我在UI中动态创建StackPanel,其中包含图像和文本块。我已经对图像应用了DropShadow效果,我想为不透明度设置动画。以下是我所拥有的: Image img = ch.ChannelLogo; //Create the image for the button img.Height = channelStackPnl.Height * .66; DropShadowEffect dSE = new DropShadowEff

如何在代码中设置DropShadow效果不透明度的动画。我在UI中动态创建StackPanel,其中包含图像和文本块。我已经对图像应用了DropShadow效果,我想为不透明度设置动画。以下是我所拥有的:

Image img = ch.ChannelLogo;  //Create the image for the button
img.Height = channelStackPnl.Height * .66;

DropShadowEffect dSE = new DropShadowEffect();
dSE.Color = Colors.White;
dSE.Direction = 25;
dSE.ShadowDepth = 10;
dSE.Opacity = .40;
img.Effect = dSE;

DoubleAnimation animateOpacity = new DoubleAnimation();
animateOpacity.From = 0;
animateOpacity.To = 1;
animateOpacity.AutoReverse = true;
animateOpacity.RepeatBehavior = RepeatBehavior.Forever;
animateOpacity.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 400));

//Here's where I am stuck.  How do I specifically target the opacity of the effect propery?
img.BeginAnimationimg.BeginAnimation(DropShadowEffect.OpacityProperty,animateOpacity);
也许


(您正在制作效果动画,而不是图像)

感谢您抽出时间回复!为什么这不是正确答案@本
dSE.BeginAnimation(DropShadowEffect.OpacityProperty, animateOpacity);