Wpf progressbar binding not updating

Another option is to use a more complex type that supports a series of derived property values. The only thing left to do is to create the Start Click method, which will be invoked when the start Button is clicked, which will in turn call the Start method on the Main Page View Model.

The Visual Boolean struct has a single field, is True, which represents the underlying Boolean value. The following code shows both the code behind for the Main Page, in Main cs, and the full source code for the Main Page View Model class.

Visibility: Used to display and hide the Text Block This would result in the following Main Page View Model: As you can see this can lead to a lot of properties that need to be updated every time data is loaded.

With the exception of the Text Block Text property, the rest of the properties are either directly, or indirectly, associated with whether data is currently being loaded.

Is Enabled: In order to disable the start Button whilst data is loading [Progress Bar].

Is Indeterminate: Rather than show an actual progress we'll just use the Indeterminate state to illustrate that data is being loaded [Progress Bar].

We can then use data binding to connect the View with the View Model.

The Main Page View Model class will be used to track the current state of the page.

Once the data has loaded the Progress Bar will be hidden and the Text Block will be displayed, showing the data.

The XAML for the layout of the page contains a Stack Panel with the start Button, Progress Bar and Text Block nested within it.

All but the most trivial Windows Phone 7 applications require some data to be loaded and displayed.

This process, whether the data is being loaded from Isolated Storage or from across the Web, can take time to complete.

An alternative strategy is to create an additional class that will be used to hold the current state of the user interface.

Tags: , ,