I have a Silverlight Business Aplication (RIA Services) and I have a DataGrid attached to a DataSource's DataContext. In a Silverlight child Windows I create a new Entity and submit the changes to the server. The problem is that my DataContext does not know that so the grid does not show the newly added entity.
How do I refresh the DataContext or tell the DataGrid to re-bind?
Edit: Here's my code
<riaControls:DomainDataSource AutoLoad="True" d:DesignData="{d:DesignInstance my:Team, CreateList=true}" Height="0" LoadedData="teamDomainDataSource_LoadedData" Name="teamDomainDataSource" QueryName="GetTeamsQuery" Width="0">
<riaControls:DomainDataSource.DomainContext>
<my:F1DomainContext />
</riaControls:DomainDataSource.DomainContext>
</riaControls:DomainDataSource>
<sdk:DataGrid AutoGenerateColumns="False" Height="200" ItemsSource="{Binding ElementName=teamDomainDataSource, Path=Data}" Name="teamDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected" DataContext="{Binding}">
<sdk:DataGrid.Columns>
<sdk:DataGridTextColumn x:Name="idColumn" Binding="{Binding Path=Id, Mode=OneWay}" Header="Id" IsReadOnly="True" Width="SizeToHeader" />
<sdk:DataGridTextColumn x:Name="nameColumn" Binding="{Binding Path=Name}" Header="Name" Width="SizeToHeader" />
</sdk:DataGrid.Columns>
</sdk:DataGrid>
As you can see my teamDataGrid
's ItemSource is the teamDomainDataSource
defined above