← About Jeff

BusyIndicator: David Poll’s ActivityControl is now in the Silverlight Toolkit November 2009 Release

November 19, 2009

Microsoft Program Manager David Poll is passionate about improving rich Internet application experiences involving data, and he previously blogged about his nice ActivityControl (here and here). The control is designer to provide a visual hint to users when an asynchronous update operation is going on – the type that can’t be interrupted.

It’s important to provide the user feedback that the UI is not hung, or crashed, but is in fact processing. This fills that void, and is really easy to get going with.

After some initial meetings with David, it became clear that the control would make a nice addition to the portfolio of valuable controls that are inside of the Silverlight Toolkit, so thanks to everyone who came together to get this added to the November release.

Quick guide to using the control

IsBusy

The key dependency property on the BusyIndicator control is the IsBusy bool property. It’s easy to data bind to your data model, or programmatically toggle on and off.

When toggled to true, the actual content of the BusyIndicator control (which itself is a ContentControl) will no longer be enabled.

Place your content inside the control

In the most simple use case, just place your content inside the control and bind to the model. When IsBusy is set to true, you’ll see the waiting user interface appear.

Your controls that are wrapped by the BusyIndicator control will not be enabled during the busy time, preventing the user from inadvertently altering the data state during the operation.

<Grid x:Name="LayoutRoot" Background="White">
    <controlsToolkit:BusyIndicator IsBusy="{Binding DataServicesAreBusy}">

        <!-- This button will not be enabled when IsBusy is set to True -->
        <Button Content="This is a button" HorizontalAlignment="Center"  VerticalAlignment="Center" Padding="8"/>

    </controlsToolkit:BusyIndicator>
</Grid>

Customizing the busy content

The entire thing is very customizable, you can use data templates and even retemplate the control. David Anson covered this in his post yesterday on the topic.

Here’s a quick example of changing the text that is displayed – the Content property can take any kind of content, so you could even put a quick game in there if you wanted to go overboard.

<Grid x:Name="LayoutRoot" Background="White">

    <controlsToolkit:BusyIndicator IsBusy="{Binding DataServicesAreBusy}">
            <controlsToolkit:BusyIndicator.BusyContent>
                <TextBlock Text="Reticulating Splines..." 
                           FontSize="18" 
                           FontWeight="Bold" />
            </controlsToolkit:BusyIndicator.BusyContent>

                <!-- This button will not be enabled when IsBusy is set to True -->
        <Button Content="This is a button" HorizontalAlignment="Center"  VerticalAlignment="Center" Padding="8"/>

    </controlsToolkit:BusyIndicator>
</Grid>

And here’s what that looks like in a real application when IsBusy is true:

Splines 

Find out more in the Silverlight Controls Browser

Just like all other controls in the Silverlight core runtime, SDK, and the Silverlight Toolkit, you’ll find the Activity Control in the Silverlight Controls Browser. It is under the Toolkit tree view item, near the bottom of the list on the left part of the app.

Silverlight 3 samples are here.
Silverlight 4 Beta samples are here, if you’re a developer and have the Silverlight 4 Beta on your machine.

BusyIndicatorSample 

Where to find the control

You’ll find the BusyIndicator control in the System.Windows.Controls.Toolkit.dll assembly, documentation in the Silverlight Toolkit docs, a few unit tests, and yeah it’s in the sample browser as well. It lives in the System.Windows.Controls namespace.

Hope you enjoy having this control available in the Silverlight Toolkit!

Download the Silverlight Toolkit November 2009 Release Today

Toolkit[3]

The Silverlight Toolkit is a collection of Silverlight controls, components and utilities that help make Silverlight development a little easier, more fun, and add value outside the regular Silverlight release cycle.

The sixth release of the Silverlight Toolkit, the November 2009 release targets Silverlight 3. There is also a release available that targets the new Silverlight 4 Beta for developers.

Resources of note:

Hope you enjoy our new release!