Silverlight data-binding not refreshing (OT?)

Silverlight data-binding not refreshing (OT?)

Old forum URL: forums.lhotka.net/forums/t/7555.aspx


SonOfPirate posted on Wednesday, September 02, 2009

Okay, so I must be missing something little.  I have a custom class I am using as the data source for my UserControl.  I define it as a static resource, set it as the DataContext then reference it as the ItemsSource for my data grid as follows:

<UserControl.Resources>
    <local:UserListViewModel x:Key="UserList" />
</UserControl.Resources>
 
<Grid x:Name="LayoutRoot"
      DataContext="{Binding Source={StaticResource UserList}}">
    <controls:DataGrid x:Name="UserGrid"
                       ItemsSource="{Binding Path=Data}"
                       AutoGenerateColumns="True"
    />
</Grid>

In the Data property of my UserListViewModel class, I am triggering an asynchronous service call to retrieve the list of items.  The QueryComplete method sets the Data property to the list returned from the call and raises the PropertyChanged event for the Data property.

However, nothing happens in the UI.  Even if I change AutoGenerateColumns to False and explicitly define the columns, nothing happens when the PropertyChanged event fires.

I've stepped through the code and everything behind the scenes appears to be working correctly, the service call is started, the QueryComplete method is called, the Data property is set to the correct object and the event raised.

What am I missing?

Copyright (c) Marimer LLC