I am populating the list view items dynamically. At the same time I wanna display a progress bar. When data populated the progress bar should be disabled. How to achieve this. I am new in WPF.
相关问题
- VNC control for WPF application
- How to let a thread communicate with another activ
- IPAddress.[Try]Parse parses 192.168 to 192.0.0.168
- Why it isn't advised to call the release() met
- WPF Binding from System.Windows.SystemParameters.P
I prefer to control view state via presentation model. When view needs to populate items in address to presentation model that starts Worker thread and updates its progress values on UI synchronization context.
XAML:
And code behind:
You can use the BackgroundWorker class, which simplifies the handling of background threads when you are working with WPF. There are plenty of examples on the web for this. Here two from codeproject, but it's easy to find more examples:
http://www.codeproject.com/Tips/83317/BackgroundWorker-and-ProgressBar-demo.aspx http://www.codeproject.com/KB/cpp/BackgroundWorker_Threads.aspx