Извините за поздний ответ, я был занят. Я исправил код, как указано ниже:
Dim context As ProductPMContext
Dim productCollectionView As DomainCollectionView
Dim products As IEnumerable(Of ProductPM)
Public Sub New()
InitializeComponent()
context = New ProductPMContext()
'You need to initialise the products collection
products = New EntityList(Of ProductPM)(context.ProductPMs)
Dim collectionViewLoader As DomainCollectionViewLoader(Of ProductPM)
'Have fixed this line, using AddressOf
collectionViewLoader = New DomainCollectionViewLoader(Of ProductPM)(AddressOf LoadProductPMList, AddressOf OnLoadProductPMListCompleted)
productCollectionView = New DomainCollectionView(collectionViewLoader, products)
productCollectionView.Refresh()
ProductListBox.ItemsSource = productCollectionView
End Sub
Public Function LoadProductPMList() As LoadOperation(Of ProductPM)
Return context.Load(context.GetProductsQuery)
End Function
Private Sub OnLoadProductPMListCompleted(ByVal op As LoadOperation(Of ProductPM))
If op.HasError = True Then
ElseIf op.IsCanceled = False Then
CType(products, EntityList(Of ProductPM)).Source = op.Entities
End If
End Sub
Надеюсь, это поможет ...
Chris