How can I stop the WPF ProgressBar pulsing/animating when it reaches 100%?

后端 未结 5 963
心在旅途
心在旅途 2021-02-05 03:52

I have an MVVM-based WPF 4 application which uses a ProgressBar to show the percentage completion of a long-running operation.



        
5条回答
  •  无人及你
    2021-02-05 04:11

    You can accomplish this by copying the entire ControlTemplate for the ProgressBar, then add a Trigger for the condition where ProgressBar.Value=100. The XAML as is will make the ProgressBar behave as it does now. Remove the comment Tags at the bottom and the animation will stop when the ProgressBar's Value property reaches 100. The only weakness is, that when you change the Maximum Property of the ProgressBar you need to change the Trigger as well. Anyone know how to bind the Trigger to the actual value of the Maximum Property?

    
        
            
                
                
                
            
            
                
                
            
            
                
                
            
            
                
                
            
            
                
                
                
                
            
            
                
                
                
            
            
                
                
                
            
            
                
                
            
            
                
                
            
            
                
                
            
            
                
                
            
            
        
        
            
        
    
    

提交回复
热议问题