The RangeBase
control is an abstract class that represents a control that oversees a
numeric value that falls between a minimum and a maximum value. Windows
Phone provides three RangeBase
controls: the ProgressBar
, ScrollBar
, and Slider
(see Figure 1).
FIGURE 1 RangeBase
controls.
The RangeBase
control provides various range related properties and events for monitoring its Value
property (see Table 1).
TABLE 1. Properties of the RangeBase
Class
Note
If the Value
property is set to a value outside the range defined by the Minimum
and Maximum
properties, no Exception
is raised. Instead the Value
property is coerced and set to either the Minimum
or Maximum
value.
However, setting Minimum
, Maximum
, Value
, SmallChange
, or LargeChange
to NaN, NegativeInfinity, or PositiveInfinity raises an ArgumentException
. In addition, setting SmallChange
or LargeChange
to a value less than zero raises an ArgumentException
.
ProgressBar
During time-consuming operations, it is
important to provide an indication to the user that your application is
busy, while still remaining responsive. The ProgressBar
serves this purpose. It is not interactive; the user cannot modify it
directly, and it is able to work in two modes: determinate and
indeterminate.
Determinate mode allows you to display a
value indicating the amount of work completed relative to the amount of
work remaining, allowing the user to estimate how long the remainder of
the operation will take. If the IsIndeterminate
property is not specified, the control defaults to determinate.
Progress is displayed by setting the Value
property of the control to the amount of work completed, and the Maximum
property to the total amount of work to be performed. There is also a Minimum
property that allows you to set a base point and can be useful when a portion of the work has already been completed.
The noninteractive nature of the control means that the Value
property is updated from code, or via a data binding, while performing a background operation.
Alternatively, when progress of an operation cannot be monitored, or the total duration of an operation is unknown, the ProgressBar
’s indeterminate mode can be engaged.
Best Practice
If the total amount of work required by an
activity is known and progress can be periodically determined, avoid
using an indeterminate ProgressBar
. Use instead a determinate ProgressBar
.
Providing clear feedback about how long a user can expect to wait for
completion of an operation improves the user’s experience.
When using the indeterminate mode by setting the IsIndeterminate
property to true
, the control is displayed as a series of animated dots.
Note
In previous versions of the Windows Phone
SDK, the ProgressBar had a performance issue. This issue has been
resolved in the Windows Phone 8 SDK.