开发者

DropShadowEffect and OuterGlowBitmapEffect animation is Taking Too much CPU and Memory usage?

Animating the DropShadoweffect and OuterGlowBitmapEffect is keep on increasing the memory and CPU usage. Why it is ta开发者_开发百科king too much memory and cpu usage and is there any way to reduce or avoid?

<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>


There is no such class as OuterGlowEffect.

Do you mean OuterGlowBitmapEffect? If so, this is a deprecated class with known performance issues, which could explain your problem. Use BlurEffect or another DropShadowEffect instead to achieve what you want. (Also, ensure you are not using the deprecated DropShadowBitmapEffect.)

But it could also be an issue with your code, in which case, post it up!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜