Hi MerrillMarie,
You can create a class that loads your data and fires an event when everything is loaded. In your page, create an instance of your class, call your load method, and also add a handler for the load completed event. In your handler you can bind/enable the grid.
Code:
Public Sub Load()
Dim oLoaderList As List(Of LoadOperation) = New List(Of LoadOperation)
oLoaderList.Add(Context.Load(Context.Table1Query(vars), AddressOf OnTable1Loaded, oLoaderList))
oLoaderList.Add(Context.Load(Context.Table2Query(vars), AddressOf OnTable2Loaded, oLoaderList))
End Sub
Each "OnLoaded" procedure calls this procedure which will fire the event when everything is done.
Code:
Private Sub UpdateLoadStatus(ByVal oOp As LoadOperation)
Try
Dim oLoaderList As List(Of LoadOperation) = oOp.UserState
oLoaderList.Remove(oOp)
If oLoaderList.Count = 0 Then
RaiseEvent DataIsLoaded()
End If
Catch ex As Exception
End Try
End Sub
In your page loaded event, call your data loader class method
Code:
Private Sub MyPage_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
oDataLoader = New cDataLoader
oDataLoader.Load()
End Sub
Bind and enable your grid when the event fires
Code:
Private Sub DataLoadComplete() Handles oDataLoader.LoadComplete
'--- handle grid here
End Sub
Hope this helps,
Randy