How do you show progress when IsIndeterminate=“True” in a WPF progress bar?

后端 未结 7 707
没有蜡笔的小新
没有蜡笔的小新 2020-12-31 07:50

This has to be the simplest question of all, but I cannot seem to figure it out. I have the progress bar in place. How do I make it show progress? How do I start the thing?<

7条回答
  •  佛祖请我去吃肉
    2020-12-31 08:40

    This is no real difference than @dyslexicanaboko above, but it is quick and easy to do for a demonstration you can control:

    In XAML:

    In code behind:

    Public Sub StartAProcess()
      pBar1.IsIndeterminate = True
    End Sub
    
    Public Sub StopAProcess()
      pBar1.IsIndeterminate = False
    End Sub
    

    Upon clicking the Start Process button the animation will start and continue until the Stop Process button is clicked. It should be obvious, but the IsIndeterminate option is not good UI practice; better to actually update the value, but for those who want to see this in action...

提交回复
热议问题