Wpf DropShadowEffect和OuterGlowBitmapEffect动画占用了太多的CPU和内存?
设置DropShadoweffect和OuterGlowBitmapEffect的动画会不断增加内存和CPU使用率。为什么它占用了太多的内存和cpu使用,有没有办法减少或避免Wpf DropShadowEffect和OuterGlowBitmapEffect动画占用了太多的CPU和内存?,wpf,Wpf,设置DropShadoweffect和OuterGlowBitmapEffect的动画会不断增加内存和CPU使用率。为什么它占用了太多的内存和cpu使用,有没有办法减少或避免 <Window.Resources> <Storyboard x:Key="Storyboard1"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName=
<Window.Resources>
<Storyboard x:Key="Storyboard1">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
Storyboard.TargetName="textBlock"
Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.BlurRadius)"
RepeatBehavior="Forever">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.9000000" Value="25"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Window.Resources>
<Window.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
</EventTrigger>
</Window.Triggers>
<Grid x:Name="LayoutRoot">
<TextBlock x:Name="textBlock" HorizontalAlignment="Left" VerticalAlignment="Top" Text="Drop Shadow Effect" TextWrapping="Wrap" Margin="189,126,0,0" FontWeight="Bold">
<TextBlock.Effect>
<DropShadowEffect ShadowDepth="5" BlurRadius="0"/>
</TextBlock.Effect>
</TextBlock>
</Grid>
没有OuterGlowEffect这样的类
你是说OuterGlowBitmapEffect吗?如果是这样的话,这是一个已知性能问题的弃用类,这可以解释您的问题。使用BlurEffect或其他DropShadowEffect来实现您想要的效果。(另外,请确保您没有使用不推荐的DropShadowBitmapEffect。)
但这也可能是你的代码的问题,在这种情况下,发布它