MVVM and SL and Name value List

MVVM and SL and Name value List

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


griff posted on Wednesday, October 27, 2010

Hi

need some help. SL4 / csla 4 /MVVM

Trying to populate name value list into a combo.  This is what I have.

Public Property MediaList() As Abraca.Business.Locations_nvl

        Private Sub LoadMediaList()

            Abraca.Business.Locations_nvl.GetAllAsync(AddressOf LoadMediaListCompleted)

        End Sub

        Private Sub LoadMediaListCompleted(ByVal sender As Object, ByVal e As Csla.DataPortalResult(Of Abraca.Business.Locations_nvl))

            If Not e.Object Is Nothing Then

                MessageBox.Show(e.Object.Item(0).Value) ' this works

                MediaList = e.Object ' this fails

            Else

                MessageBox.Show(e.Error.Message)

            End If

        End Sub

This fails ... MediaList = e.Object 

Because this .... Public Property MediaList() As Abraca.Business.Locations_nvl does not create a New instance but New is private. Can anyone advise please.

My combo is bound to the property MediaList in my viewmodel.

Richard

 

 

 

RockfordLhotka replied on Wednesday, October 27, 2010

I don't understand what you are saying? You are somehow trying to New up the object, and that fails because of the private constructor?

Your code doesn't look abnormal - I assume GetAllAsync() is a factory method that calls the data portal - so there's no point here where you'd be trying to New up an object - the object is created by the data portal on the server.

Or are you saying that the property you are trying to set is a read-only property? That's not what the code looks like either.

I guess, in short, without an actual exception and stack trace there's no way to help you.

Copyright (c) Marimer LLC