Hi together i am Korbinian and i investigate currently a CPU cosumption problem regarding WPF and animated UI elements. We animate a UI element via System.Windows.Media.Animation.DoubleAnimation methode BeginAnimation. I am quite new to WPF especially animation.
Timeline.DesiredFrameRateProperty.OverrideMetadata(typeof(Timeline),
new FrameworkPropertyMetadata { DefaultValue = 8 });
flashAnimation = new DoubleAnimation(1, 0.3, TimeSpan.FromMilliseconds(330), FillBehavior.Stop)
{
RepeatBehavior = RepeatBehavior.Forever,
AutoReverse = true
};
this.BeginAnimation(FlashOpacityProperty, flashAnimation);
hint: I already tried in the snippet above to reduce the DesiredFrameRate to 8 in order to reduce the CPU consumption.
As far as i can see during debugging, the FlashOpacityProperty's Callback (PropertyChangedCallback) is called around 8 times per second. This amount of callbacks is somehow independent from what is defined in the constructor of the DoubleAnimation. My Goal is to reduce the amount of callbacks. For my use case its not important to have a fluent and nice looking animation. It should mainly support for highlighting.
Is is possible to reduce the amount of callbacks? Or is this a fix kind of animation from .Net?
Thank you very much in advance