I have an MVVM-based WPF 4 application which uses a ProgressBar to show the percentage completion of a long-running operation.
You can swap the converter being used by PART_Indicator
which by default is the ProgressBarBrushConverter
which is where the animation is coming from...
...
TranslateTransform transform = new TranslateTransform();
double num11 = num8 * 100;
DoubleAnimationUsingKeyFrames animation = new DoubleAnimationUsingKeyFrames();
animation.Duration = new Duration(TimeSpan.FromMilliseconds(num11));
animation.RepeatBehavior = RepeatBehavior.Forever;
for (int i = 1; i <= num8; i++)
{
double num13 = i * num7;
animation.KeyFrames.Add(new DiscreteDoubleKeyFrame(num13, KeyTime.Uniform));
}
transform.BeginAnimation(TranslateTransform.XProperty, animation);
...
The default logic for the ProgressBarBrushConverter
can then be modified to suit your needs.
You may have to end up passing parameters to the converter so that it can check the value and provide the appropriate animation or lack thereof contingent on the state of the ProgressBar
.