This article is compatible with the latest version of Silverlight.
Introduction
When it comes to making calls to a Web Service in Silverlight you have no other way, but to do it async. In many scenarios this could be a problem and especially when you use data binding.
The Problem
Consider you have a business objects Merchant and Sale and the Merchant has property Sales of type List as shown on the class diagram.

The sales are loaded from a web service.
public List Sales
{
get
{
if ( this.sales == null )
{
this.sales = new List();
MerchantServiceSoapClient client = new MerchantServiceSoapClient();
client.GetMerchantSalesCompleted += new EventHandler( this.GetMerchantSalesCompleted );
client.GetMerchantSalesAsync();
}
return this.sales;
}
}
private void GetMerchantSalesCompleted( object sender, GetMerchantSalesCompletedEventArgs e )
{
this.sales = e.Result;
}
Basically what you need in most cases is just to bind to the sales list. Ok, what do you think would happen if we use the following code?
Code
this.DataContext = new Merchant();
XAML
<ListBox x:Name="Sales" ItemsSource="{Binding Sales}" >
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding ProductName}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
The correct answer is nothing. No data will be displayed in the ListBox. The reason why this is true is simple - the ListBox is correctly bound to the Sales property, but it returns though null value because in the time of data binding there is no result returned from the web service.
The Solution
In order to make that works we need to implement the INotifyPropertyChanged interface and raise the PropertyChanged event once the data is received.

private void GetMerchantSalesCompleted( object sender, GetMerchantSalesCompletedEventArgs e )
{
this.sales = e.Result;
if ( this.PropertyChanged != null )
{
this.PropertyChanged( this, new PropertyChangedEventArgs( "Sales" ) );
}
}
Now we are done - the ListBox is notified about the changed data and displays the sales correctly.
Summary
Going async has some gotchas on the way and you should be careful with them. That one is pretty common and developers, not used to using async operations, get surprised when they get no results. I'll be glad to give you answers to any other questions in this direction. Just post them as a comment.